bundle install
実行中のエラーの、出鼻挫かれる感半端ない。
今回のエラーは「rmagick」のインストール時のこれ。
エラー内容
:
:
Fetching rmagick 2.16.0
Installing rmagick 2.16.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/var/local/lib/app/farmer_base/vendor/bundle/ruby/2.4.0/gems/rmagick-2.16.0/ext/RMagick
/usr/local/rbenv/versions/2.4.1/bin/ruby -r ./siteconf20180718-322-8rdqll.rb
extconf.rb
checking for gcc... yes
checking for Magick-config... no
checking for pkg-config... yes
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
checking for outdated ImageMagick version (<= 6.4.9)... *** 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.1/bin/$(RUBY_BASE_NAME)
/usr/local/rbenv/versions/2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/version.rb:209:in
`initialize': Malformed version number string (ArgumentError)
from
/usr/local/rbenv/versions/2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/version.rb:200:in
`new'
from
/usr/local/rbenv/versions/2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/version.rb:200:in
`new'
from extconf.rb:84:in `block in configure_compile_options'
from /usr/local/rbenv/versions/2.4.1/lib/ruby/2.4.0/mkmf.rb:945:in `block in
checking_for'
from /usr/local/rbenv/versions/2.4.1/lib/ruby/2.4.0/mkmf.rb:351:in `block (2
levels) in postpone'
from /usr/local/rbenv/versions/2.4.1/lib/ruby/2.4.0/mkmf.rb:321:in `open'
from /usr/local/rbenv/versions/2.4.1/lib/ruby/2.4.0/mkmf.rb:351:in `block in
postpone'
from /usr/local/rbenv/versions/2.4.1/lib/ruby/2.4.0/mkmf.rb:321:in `open'
from /usr/local/rbenv/versions/2.4.1/lib/ruby/2.4.0/mkmf.rb:347:in `postpone'
from /usr/local/rbenv/versions/2.4.1/lib/ruby/2.4.0/mkmf.rb:944:in
`checking_for'
from extconf.rb:81: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:
/var/local/lib/app/farmer_base/vendor/bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0-static/rmagick-2.16.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
/var/local/lib/app/farmer_base/vendor/bundle/ruby/2.4.0/gems/rmagick-2.16.0 for
inspection.
Results logged to
/var/local/lib/app/farmer_base/vendor/bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0-static/rmagick-2.16.0/gem_make.out
An error occurred while installing rmagick (2.16.0), and Bundler cannot
continue.
Make sure that `gem install rmagick -v '2.16.0' --source
'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
rmagick
ネイティヴエクステンションを使ってインストールしようとしてエラーが発生。
対処方法
このエラーに出会っている人はネットを探すとたくさん見かけます。
対処方法は色々存在しますが、私の場合は、そもそも元になるパッケージが、OS内に入っていないことが原因でした。
ということで、yum
でインストール。
$ sudo yum -y install ImageMagick ImageMagick-devel
これで bundle install
が通るようになります。