在山狮上安装Rmagick时出错

我曾经见过其他人在山狮上安装RMagick的问题。但是没有一个build议的解决scheme允许我成功安装rmagick。

这是我得到的错误消息:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. checking for Ruby version >= 1.8.5... yes checking for /usr/local/bin/gcc-4.2... yes checking for Magick-config... yes checking for ImageMagick version >= 6.4.9... yes checking for HDRI disabled version of ImageMagick... yes checking for stdint.h... yes checking for sys/types.h... yes checking for wand/MagickWand.h... yes checking for InitializeMagick() in -lMagickCore... no checking for InitializeMagick() in -lMagick... no checking for InitializeMagick() in -lMagick++... no Can't install RMagick 2.13.1. Can't find the ImageMagick library or one of the dependent libraries. Check the mkmf.log file for more detailed information. *** 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. 

我做的事情:

 Installed XCode Installed the command line tools Installed XQuartz Installed homebrew with imagemagick library Installed most recent version of RVM Symlinked GCC Uninstalled and reinstalled both RVM and imagemagick 

任何想法,为什么我仍然不能下载rmagick?

这似乎是一个问题,报告自制github回购( https://github.com/mxcl/homebrew/issues/16625 )指责rmagick本身不支持新版本的imagemagick。 在同样的问题上( https://github.com/mxcl/homebrew/issues/16625#issuecomment-11519383 ),你可以find这个链接: https : //coderwall.com/p/wnomjg其实为我工作。 这就是他所做的:

 cd /usr/local/Cellar/imagemagick/6.8.0-10/lib ln -s libMagick++-Q16.7.dylib libMagick++.dylib ln -s libMagickCore-Q16.7.dylib libMagickCore.dylib ln -s libMagickWand-Q16.7.dylib libMagickWand.dylib 

希望这可以帮助。

我们所做的是以下几点:

 cd /usr/local git checkout 834ce4a Library/Formula/imagemagick.rb brew install imagemagick 

这将安装Imagemagick 6.7.7-6

我知道这是旧的,但我已经经历了一堆这些反应,仍然无法使其工作。 我发现了另一种语言的随机链接,实际上解决了我的问题( http://sugiarto.webmuapp.com/Package_MagickCore_was_not_found_in_the_pkg_config_search_path )。 看起来它正在寻找没有设置的PKG_CONFIG_PATH。

什么对我有效:

 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig 

然后确保它的工作:

 find /usr -name 'MagickCore.pc' /usr/local/Cellar/imagemagick/6.8.0-10/lib/pkgconfig/MagickCore.pc /usr/local/lib/pkgconfig/MagickCore.pc 

然后再次尝试安装rmagick:

 gem install rmagick Building native extensions. This could take a while... Successfully installed rmagick-2.13.2 1 gem installed Installing ri documentation for rmagick-2.13.2... Installing RDoc documentation for rmagick-2.13.2... 

成功! 希望这可以帮助任何人仍然遇到这个问题。

从其他答案:

 PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.8.0-10/lib/pkgconfig C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.8.0-10/include/ImageMagick gem install rmagick -v '2.13.1' 

请参阅https://stackoverflow.com/a/10645011/1197775了解如何获取这些目录。;

这是在macOS Sierra上为我工作的。

 brew uninstall pkg-config brew install pkg-config brew unlink pkg-config brew link pkg-config 

检查我的答案openssl问题https://stackoverflow.com/a/13958931/497756 – 只要确保imagemagick编译包括*.pc文件 – 这是大多数软件的默认,但不是全部。