问题
I am getting an error when trying to install rails (or more specifically, atomic).
Building native extensions. This could take a while... ERROR: Error installing rails: ERROR: Failed to build gem native extension.
/Users/dima/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb creating Makefile
make compiling atomic_reference.c atomic_reference.c:50:9: warning: implicit declaration of function 'OSAtomicCompareAndSwap64' is invalid in C99 [-Wimplicit-function-declaration]
if (OSAtomicCompareAndSwap64(expect_value, new_value, &DATA_PTR(self))) {
^ 1 warning generated. linking shared-object atomic_reference.bundle
make install /usr/bin/install -c -m 0755 atomic_reference.bundle /Users/dima/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/atomic-1.1.10/lib/Users/dima/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/x86_64-darwin12.4.0 install: /Users/dima/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/atomic-1.1.10/lib/Users/dima/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/x86_64-darwin12.4.0: No such file or directory make: *** [install-so] Error 71
Gem files will remain installed in /Users/dima/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/atomic-1.1.10 for inspection. Results logged to /Users/dima/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/atomic-1.1.10/ext/gem_make.out
I'm basically just following the rails tutorial (for rails 4.0 and ruby 2.0, seen here) and have kind of hit a wall here, unfortunately, unable to find much info on what's happening here.
I found this question and followed both suggestions in the answer with the same result.
回答1:
Had the very same problem, coming from that same tutorial. Got it to work following this post. Ran a few command to compare gemsets with the post but what seem to fix the problem was
- gem update --system (without the "2.0.0" from tutorial, updated me to 2.0.3)
- gem update
- gem install rails (again without specifying the version)
And finally it installed properly
回答2:
So, in my case what seems to be failing is that the Makefile has a INSTALL=./install and there is no ./install. I edited the Makefile to take out the ./ and then created a local spec with
gem spec ../../../cache/atomic-1.1.14.gem --ruby > ../../../specifications/atomic-1.1.14.gemspec
subsequent
gem install rails
succeeded, but no idea if this screwed up my rails instance.
来源:https://stackoverflow.com/questions/17385535/error-installing-ruby-on-rails-4-0-atomic-reference-c-error-71