Can't install RMagick 2.13.1. Can't find MagickWand.h.

ImageMagick 6.7.3-7をソースからインストールした環境に、gemでRMagickをインストールしようとしたら、以下のエラーが発生した。

$ sudo gem install rmagick
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
	ERROR: Failed to build gem native extension.
        /opt/ruby-enterprise-1.8.7-2011.03/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... 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
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
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
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 stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no
Can't install RMagick 2.13.1. Can't find MagickWand.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.
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/ruby-enterprise-1.8.7-2011.03/bin/ruby
Gem files will remain installed in /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/rmagick-2.13.1 for inspection.
Results logged to /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out

ImageMagickは6.7.3-7をソースからインストールしている。
ImageMagick 6.6.9-10の場合は、Rmagickをインストールできた。

対処方法

エラーメッセージに、

Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable

とあるので、MagickCore.pcが含まれているディレクトリを探して、PKG_CONFIG_PATHにセットするとインストールできた。

$ find /usr/local -name MagickCore.pc
/usr/local/lib/pkgconfig/MagickCore.pc
$ sudo PKG_CONFIG_PATH=/usr/local/lib/pkgconfig gem install rmagick
Building native extensions.  This could take a while...
Successfully installed rmagick-2.13.1
1 gem installed
Installing ri documentation for rmagick-2.13.1...
Installing RDoc documentation for rmagick-2.13.1...

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です