HK15
HK15

Reputation: 807

Mac Rmagick 2.13.2 ERROR: Failed to build gem native extension

Recently I've updated my Mac to El Capitan and re-installed (with Homebrew) ImageMagick 6.9.2-7

Unfortunately bundle install doesn't work because RMagick fails to build.

Here the stack trace:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/me/.rvm/rubies/ruby-1.9.3-p327/bin/ruby -r ./siteconf20151204-39308-uw4m6y.rb extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for /usr/local/opt/gcc46/bin/gcc-4.6... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... *** 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=/Users/me/.rvm/rubies/ruby-1.9.3-p327/bin/ruby
/Users/me/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/me/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
    from /Users/me/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
    from /Users/me/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /Users/me/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /Users/me/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/me/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /Users/me/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/me/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /Users/me/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /Users/me/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
    from extconf.rb:194:in `<main>'

extconf failed, exit code 1

I've tried several different solutions founded on Internet but nothing seems to fix this error.

With the operations below I receive always the errore above:

1) C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.9.2-7/include/ImageMagick-6/ gem install rmagick -v '2.13.2'



2) gem install rmagick --version=2.13.2 --platform=ruby -- --with-opt-lib="h:/ImageMagick-6.9.2-7/lib" --with-opt-include="h:/ImageMagick-6.9.2-7/include"

3) $ cd /usr/local/Cellar/imagemagick/6.9.2-7/lib
$ ln -s libMagick++-Q16.6.dylib   libMagick++.dylib
$ ln -s libMagickCore-Q16.2.dylib libMagickCore.dylib
$ ln -s libMagickWand-Q16.2.dylib libMagickWand.dylib

The error still the same:

The compiler failed to generate an executable file. (RuntimeError)

You have to install development tools first.

I've also updated xcoce to 7.1.1

I'm using ruby-1.9.3-p327 with RVM

Thanks in advance.

Upvotes: 3

Views: 1142

Answers (2)

eebbesen
eebbesen

Reputation: 5148

None of these worked in isolation for me, but the running of all of them seemed to do the trick:

xcode-select --install
brew unlink imagemagick
brew uninstall --force imagemagick
brew update
brew doctor
brew install imagemagick

That's likely overkill but in the end worked for me.

Upvotes: 1

slowpoke
slowpoke

Reputation: 143

You need to update Xcode and install Command Line Tools (xcode-select --install).

Upvotes: 2

Related Questions