Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade to Lion, failed to build gem native extensions

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??

like image 725
Tony Beninate Avatar asked Jul 28 '11 01:07

Tony Beninate


2 Answers

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

like image 131
Jeff Peterson Avatar answered Nov 14 '22 22:11

Jeff Peterson


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

like image 26
MAP Avatar answered Nov 14 '22 23:11

MAP