Chefとか使ってるに限らず、環境構築をしている際にImageMagickの強敵具合に戸惑うことあるよね。
Railsでの開発やrubyを使用した開発の際にrmagickはほぼ必須です。
今回はImageMagick6を使用してrmagickをインストールしようとした時に発生したエラーです。
Centos7にchefで環境構築をし、
capistrano3でデプロイ作業をしている時に、エラーが起きちゃいましたよ(・ω・)ノ。
先に解決策をいうと、ImageMagickのc++ パッケージをインストールしてください。
1 |
sudo yum install -y ImageMagick6-c++-devel |
エラーの内容
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
/opt/rbenv/versions/2.2.3/bin/ruby -r ./siteconf20180301-16108-jcs9d5.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=/opt/rbenv/versions/2.2.3/bin/$(RUBY_BASE_NAME) extconf failed, exit code 1 Gem files will remain installed in /opt/test/shared/bundle/ruby/2.2.0/gems/rmagick-2.15.4 for inspection. Results logged to /opt/test/shared/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/rmagick-2.15.4/gem_make.out An error occurred while installing rmagick (2.15.4), and Bundler cannot continue. Make sure that `gem install rmagick -v '2.15.4'` succeeds before bundling. In Gemfile: rmagick (Backtrace restricted to imported tasks) cap aborted! SSHKit::Runner::ExecuteError: Exception while executing as ec2-user@test: bundle exit status: 5 bundle stdout: Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /opt/rbenv/versions/2.2.3/bin/ruby -r ./siteconf20180301-16108-jcs9d5.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=/opt/rbenv/versions/2.2.3/bin/$(RUBY_BASE_NAME) extconf failed, exit code 1 Gem files will remain installed in /opt/test/shared/bundle/ruby/2.2.0/gems/rmagick-2.15.4 for inspection. Results logged to /opt/test/shared/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/rmagick-2.15.4/gem_make.out An error occurred while installing rmagick (2.15.4), and Bundler cannot continue. Make sure that `gem install rmagick -v '2.15.4'` succeeds before bundling. In Gemfile: rmagick bundle stderr: Nothing written SSHKit::Command::Failed: bundle exit status: 5 bundle stdout: Gem::Ext::BuildError: ERROR: Failed to build gem native extension. |
なっげ!!!
ふざけんなww!!わら
ポイントはここになります。
「MagickCore」がねえんだ!!って言いたいようだ。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
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=/opt/rbenv/versions/2.2.3/bin/$(RUBY_BASE_NAME) extconf failed, exit code 1 |
いくつか解決手段はあるようですが、packageで解決できる場合もあります。
前述した通り、ImageMagick6-c++-develをインストールします。
remiでインストールすることを忘れないように
解決策
1 |
sudo yum install -y ImageMagick6-c++-devel |
これで依存関係のあるパッケージ群をインストールしてくれます。
1 2 3 4 5 6 |
インストール中: ImageMagick6-c++-devel 依存性関連でのインストールをします: ImageMagick6 ImageMagick6-c++ ImageMagick6-devel |
これでRmagickがインストールされるはずです。
解決だね。
じゃあね〜〜。