如何在OS X 10.8.2上安装rmagic 2.13.1和imagemagick?

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.
2个回答

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以反映其依赖关系的变化(已经过时了一两年)。但我不知道足够的知识来自己做到这一点。


0

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


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接