Upgrade to Lion, failed to build gem native extensions

◇◆丶佛笑我妖孽 提交于 2019-12-23 12:13:37

问题


Not sure if my problem is related to this thread (http://stackoverflow.com/questions/6589066/rmagick-and-os-x-lion), but I just upgraded to Lion; more specifically I purchased an new machine and migrated over my old profile.

I am unable to launch rails 3 because it cannot find rmagick, and I am unable to install rmagick, because I get the following error. I tried uninstalling rmagick and imageMagick, but I still get the same error when attempting to bundle install. Any thoughts? Thank you

Installing rmagick (2.13.1) with native extensions /opt/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:551:in `build_extensions': ERROR:     Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

    /opt/local/bin/ruby extconf.rb 
checking for Ruby version >= 1.8.5... yes
checking for /usr/bin/gcc-4.2... no
No C compiler found in ${ENV['PATH']}. See mkmf.log for details.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/opt/local/bin/ruby


Gem files will remain installed in /opt/local/lib/ruby/gems/1.8/gems/rmagick-2.13.1 for inspection.
Results logged to /opt/local/lib/ruby/gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:504:in `each'
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:504:in `build_extensions'
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:180:in `install'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/source.rb:101:in `install'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/source.rb:91:in `install'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/installer.rb:58:in `run'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:93:in `with_build_args'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/installer.rb:57:in `run'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/installer.rb:49:in `run'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/installer.rb:8:in `install'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/cli.rb:222:in `install'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor/task.rb:22:in `send'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor/task.rb:22:in `run'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor/base.rb:389:in `start'
from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.15/bin/bundle:13
from /opt/local/bin/bundle:19:in `load'
from /opt/local/bin/bundle:19

UPDATE So I updated to Xcode4 and when I brew --config it still indicates that I am missing GCC stuff:

HOMEBREW_VERSION: 0.8
HEAD: 8368fe489bde47b8f201bfcfdf328944fdf7092b
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_LIBRARY_PATH: /usr/local/Library/Homebrew
Hardware: quad-core 64-bit sandybridge
OS X: 10.7
Kernel Architecture: x86_64
Ruby: 1.8.7-249
/usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Xcode: 
GCC-4.0: N/A 
GCC-4.2: N/A 

How can this be??


回答1:


It appears that you need to install Xcode's Unix Development Tools.

You can install the Unix tools when you install Xcode from the Mac App Store: http://itunes.apple.com/us/app/xcode/id448457090?mt=12




回答2:


I've tried all the methods mentioned here, nothing helped. This saved my day: https://gist.github.com/3182604

NOTE: 1. Update XCode from Preferences/Downloads 2. Install X11.app 3. And only then fix ImageMagick gem




回答3:


From the Homebrew installations instructions at https://github.com/mxcl/homebrew/wiki/Installation

"1 Installing via the App Store only works for Lion users. For other versions of Mac OS X, see here. If you do install via the App Store, you will need to run the “Install Xcode” app that is placed in /Applications."



来源:https://stackoverflow.com/questions/6853111/upgrade-to-lion-failed-to-build-gem-native-extensions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!