2012年7月1日日曜日

rmagickエラーld: library not found for -lgomp

またしても見たことないエラーが発生したので、その対処法を書きます。
gemfileにgem 'rmagick'してbundle install しようとしたら
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for clang... 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.
て言われたので、実際に .rvm/gems/ruby-1.9.3-p125/gems/rmagick-2.13.1/ext/rmagick/mkmf.logをみてみることに。 表題の
ld: library not found for -lgomp

という今までに見たことないエラーが書かれていた。 
ですでに、imagemagickはbrewでインストールしていたので、一度brew unlink imagemagickして、 brew ls -aすると、unlinkしてもそこに居続けるのがわかる。gemからも一度gem uninstall rmagickしておく。
次に
$ brew install imagemagick --disable-openmp
$ gem install rmagick
で問題なくいった。

さすが、stackoverflowや!
http://stackoverflow.com/questions/7961091/mac-rmagick-wont-install-with-xcode-4-2