RMagick 2.16.0 をインストールできません。 MagickWand.h が見つかりません Mac OS Sonoma
概要
Mac OS Sonoma 14.2.1 を使用しています
ルビー2.6.5
imagemagick@6: 安定版 6.9.13-4
私はやろうとしています gem install rmagick -v 2.16.0 それを捕まえる
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
current directory: /Users/alenavolosina/.rbenv/versions/2.6.5/gemsets/mosreg-base_4/gems/rmagick-2.16.0/ext/RMagick
/Users/alenavolosina/.rbenv/versions/2.6.5/bin/ruby -I /Users/alenavolosina/.rbenv/versions/2.6.5/lib/ruby/2.6.0 -r ./siteconf20240111-64476-m23n6.rb extconf.rb
checking for clang... yes
checking for Magick-config... yes
checking for outdated ImageMagick version (<= 6.4.9)... no
checking for presence of MagickWand API (ImageMagick version >= 6.9.0)... no
checking for Ruby version >= 1.8.5... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no
Can't install RMagick 2.16.0. 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=/Users/alenavolosina/.rbenv/versions/2.6.5/bin/$(RUBY_BASE_NAME)
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/alenavolosina/.rbenv/versions/2.6.5/gemsets/mosreg-base_4/extensions/-darwin-23/2.6.0/rmagick-2.16.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/alenavolosina/.rbenv/versions/2.6.5/gemsets/mosreg-base_4/gems/rmagick-2.16.0 for inspection.
Results logged to /Users/alenavolosina/.rbenv/versions/2.6.5/gemsets/mosreg-base_4/extensions/-darwin-23/2.6.0/rmagick-2.16.0/gem_make.out
コマンド find /usr/local /opt/homebrew -name “MagickWand.h” 問題
/opt/homebrew/Cellar/imagemagick@6/6.9.13-4/include/ImageMagick-6/wand/MagickWand.h
/opt/homebrew/Cellar/imagemagick/7.1.1-26/include/ImageMagick-7/MagickWand/MagickWand.h
私はそれを試してみました
brew install imagemagick@6 && brew link imagemagick@6 --force
export LDFLAGS="-L/usr/local/opt/imagemagick@6/lib"
export CPPFLAGS="-I/usr/local/opt/imagemagick@6/include"
export PKG_CONFIG_PATH="/usr/local/opt/imagemagick@6/lib/pkgconfig"
brew uninstall pkg-config && brew install pkg-config
PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig gem install rmagick -v '2.16.0'
等
stackoverflow などをすべて試し、依存ライブラリをすべて再インストールしてみました。rbenv を使用して Ruby 2.6.5 も再インストールしました。行き止まりです。助けてください。善良な人々
解決策
MagickWand.h ヘッダー ファイルが見つからないようです。 詳細については、mkmf.log ファイルを確認してください。ただし、次のような問題の通常の原因となるいくつかのことを試してみてください。
brew install imagemagick@6
brew link imagemagick@6 --force
export PKG_CONFIG_PATH="/usr/local/opt/imagemagick@6/lib/pkgconfig"
gem install rmagick -v '2.16.0' -- --with-magick-wand-include="/usr/local/opt/imagemagick@6/include/ImageMagick-6/wand"
これらのどれもうまくいかない場合は、imagemagick と rmagick をアンインストールして再インストールしてみてください。 また、複数のバージョンがインストールされていないことを確認してください。これにより、競合が発生する場合があります。 私が思いつく最後のことは、Ruby をアンインストールして再インストールしてみること、そして時々問題を引き起こす可能性があるため、macOS が最新であることを確認することです。