Ubuntuのgem updateでrmagick-2.15.1のインストールに失敗した場合の対処法。
gem updateを実行すると次のようなエラーが表示される。
*** 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/bin/ruby2.1
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.1.0/gems/rmagick-2.15.1 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/rmagick-2.15.1/gem_make.out
Gems updated: rmagick
指示されたとおりにgem_make.outを閲覧する。
/usr/bin/ruby2.1 extconf.rb
checking for gcc... yes
checking for Magick-config... no
checking for pkg-config... no
Can't install RMagick 2.15.1. Can't find Magick-config or pkg-config in /usr/loc
al/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
*** 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/bin/ruby2.1
extconf failed, exit code 1
「Can’t install RMagick 2.15.1. Can’t find Magick-config or pkg-config」とあるので、rmagicをインストールすれば良いのかな・・・と思うけど、Ubuntuではパッケージの名前が全然違うので、libmagickwand-devをインストールする必要がある。
sudo apt-get install libmagickwand-dev sudo gem update
これで正常にインストールが完了する。