我几天前升级到El Capitan并且跑了
brew update && brew upgrade
它更新了imagemagick,导致ruby的rmagick gem停止工作。
没问题,我想,我只是跑
gem install rmagick
它将重新编译。
除非它没有,当我运行它时,我看到了:
gem install rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/sam/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20151019-57347-30ju1w.rb extconf.rb
checking for clang... yes
checking for Magick-config... yes
checking for outdated ImageMagick version (<= 6.4.9)... no
checking for Ruby version >= 1.8.5... 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
--without-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/sam/.rbenv/versions/2.2.3/bin/$(RUBY_BASE_NAME)
/Users/sam/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/sam/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:587:in `try_cpp'
from /Users/sam/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:1060:in `block in have_header'
from /Users/sam/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for'
from /Users/sam/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /Users/sam/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /Users/sam/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
from /Users/sam/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /Users/sam/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
from /Users/sam/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for'
from /Users/sam/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:1059:in `have_header'
from extconf.rb:38:in `configure_headers'
from extconf.rb:18:in `initialize'
from extconf.rb:517:in `new'
from extconf.rb:517:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/sam/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rmagick-2.15.4 for inspection.
Results logged to /Users/sam/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/rmagick-2.15.4/gem_make.out
以下是mkmf.log的内容
find_executable: checking for clang... -------------------- yes
--------------------
find_executable: checking for Magick-config... -------------------- yes
--------------------
configure_compile_options: checking for outdated ImageMagick version (<= 6.4.9)... -------------------- no
Detected ImageMagick version: 6.9.2
--------------------
assert_minimum_ruby_version!: checking for Ruby version >= 1.8.5... -------------------- yes
--------------------
"clang -o conftest -I/Users/sam/.rbenv/versions/2.2.3/include/ruby-2.2.0/x86_64-darwin14 -I/Users/sam/.rbenv/versions/2.2.3/include/ruby-2.2.0/ruby/backward -I/Users/sam/.rbenv/versions/2.2.3/include/ruby-2.2.0 -I. -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 conftest.c -L. -L/Users/sam/.rbenv/versions/2.2.3/lib -L/usr/local/Cellar/imagemagick/6.9.2-4/lib -lMagickCore-6.Q16 -L/usr/local/Cellar/imagemagick/6.9.2-4/lib -lMagickCore-6.Q16 -lruby-static -framework CoreFoundation -lpthread -lgmp -ldl -lobjc "
ld: library not found for -lgmp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
有什么想法吗?
答案 0 :(得分:17)
修正了它。
要运行的神奇命令是:
xcode-select --install
答案 1 :(得分:0)
升级到El Capitano后我遇到了同样的问题。我在以前的操作系统版本下安装了rvm和ruby。重新安装ruby为我解决了这个问题。如果您使用的是rvm,请运行rvm reinstall [your-ruby-version]
。您应该可以在此之后安装rmagick
gem而不会出错。希望有所帮助。