3

我已经阅读了很多帖子,似乎在 OS X 上安装 rmagick gem 时遇到了问题,但是为 MagickCore 设置 PATH 变量的解决方案似乎都不适合我。尝试安装 gem 时,我不断提出相同的堆栈跟踪。

这是我每次都得到的,我不知道如何克服它。

Installing rmagick (2.13.1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/mwallace/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for clang... 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... 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.

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/mwallace/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
    --with-MagickCorelib
    --without-MagickCorelib
    --with-Magicklib
    --without-Magicklib
    --with-Magick++lib
    --without-Magick++lib


Gem files will remain installed in /Users/mwallace/.rvm/gems/ruby-1.9.3-p194@recruittalk/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/mwallace/.rvm/gems/ruby-1.9.3-p194@recruittalk/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
An error occurred while installing rmagick (2.13.1), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.1'` succeeds before bundling.
4

2 回答 2

0

我建议切换到 mini_magick gem。您可以获得 ImageMagick 提供的所有功能,但安装更容易,内存占用量也更低。

于 2013-06-21T11:25:14.257 回答
0

我有同样的问题。我需要说,虽然我对 Ruby、Rails、Homebrew(以及 Unix 文件结构)还是很陌生……但是……

我怀疑一旦你解决了 PKG_CONFIG_PATH 问题,你就会有另一个问题。我将提出一个可能适用于第一个也可能不适用的快速建议,然后解释我为第二个做了什么。

首先,我在某处发现了将其添加到 .bashrc 的建议:PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"。几个小时前我这样做了,它可能为我解决了第一个问题。不过具体我记不太清了。

其次,我认为 imagemagick 6.8 版已经弃用了这些所需的方法:

checking for InitializeMagick() in -lMagickCore... no
checking for InitializeMagick() in -lMagick... no
checking for InitializeMagick() in -lMagick++... no

所以早期版本仍然会有它们。我按照此处的说明(http://wearepandr.com/blog/article/homebrew-and-installing-old-package-versions)安装了旧版本的软件包。卸载 imagemagick,在 /usr/local/Library/Formula/ 中运行建议的命令,然后重新安装 imagemagick,我能够成功安装 rmagick gem。我随机选择了 6.7.1-1 种。

我真的认为有人应该更新 rmagick 以反映对其依赖项的更改(它已经过时了一两年)。但我自己还不够了解。

于 2013-01-08T00:27:35.243 回答