gem install rmagickが失敗した原因が全く分からなかった件(解決済み)
VPSを借りて、Rails環境を構築していたわけだが、画像処理を行いたくてrmagickをインストール。しかし、エラーが発生して、全く理由が分からず、右往左往。最終的に解決したけど、記録として残しておく。
>gem install rmagick
しかし、エラーが発生!(泣) エラーログはこちら↓。
current directory: /usr/local/rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/rmagick-2.16.0/ext/RMagick
/usr/local/rbenv/versions/2.4.3/bin/ruby -r ./siteconf20171218-2913-1jh7ths.rb extconf.rb
checking for gcc... yes
checking for Magick-config... yes
*** 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=/usr/local/rbenv/versions/2.4.3/bin/$(RUBY_BASE_NAME)
extconf.rb:189:in ``': No such file or directory - which (Errno::ENOENT)
from extconf.rb:189:in `has_graphicsmagick_libmagick_dev_compat?'
from extconf.rb:66:in `configure_compile_options'
from extconf.rb:16:in `initialize'
from extconf.rb:548:in `new'
from extconf.rb:548:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0-static/rmagick-2.16.0/mkmf.log
extconf failed, exit code 1
ウェブから色々な情報を探すも、同じようなエラーが起こった人が見つからない。
中国のサイトみたいなところがでてきたけど、回答は載っておらず。
最終的に辿り着いたのがこちら。
原因は、whichコマンドがインストールされていないためらしい。
確かに、借りたばかりのVPSだからそうかもしれない。
>yum install which
問題なく、whichコマンドをインストール。さて、ドキドキ。改めてrmagickをインストール。
>gem install rmajick
成功!感謝です!! まだまだ修行が足りませんでした。