如何在OS X 10.8.3上安装rmagic 2.12.2?

4
我正在尝试将locomotive gem安装到我的rails app中。它有一个依赖项需要使用rmagick gem 2.12.2版本。
我成功地安装了最新版本的rmagic 2.13.2,但显然这个gem所需的旧版本与我的imagemagick安装(版本为6.8.0-10)存在某种路径问题。
我已经阅读了很多帖子,都说要设置不同的环境路径,并重新安装brew和其他方法来解决问题。主要问题在于rmagic版本,以及它对imagemagick位置和版本的依赖。
当前我从gem install中得到以下错误信息。
    ERROR:  Error installing rmagick:
    ERROR: Failed to build gem native extension.

        /Users/mwallace/.rvm/rubies/ruby-1.9.3-p362/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
extconf.rb:107: Use RbConfig instead of obsolete and deprecated Config.
checking for clang... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.3.5... 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
Can't install RMagick 2.12.2. 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
    --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-p362/bin/ruby
    --with-MagickCorelib
    --without-MagickCorelib
    --with-Magicklib
    --without-Magicklib

你手动安装了最新版本的XQuartz吗? - David West
1个回答

1

我刚遇到了这个问题。问题在于rmagick 2.12.2与ImageMagick 6.8或更高版本不兼容。从rmagick 2.13.2的更新日志中可以看到:

RMagick 2.13.2
    o Fixed issues preventing RMagick from working with version 6.8 or higher
    o Fixed issues preventing RMagick from working with ruby 1.9.3 

如果您必须使用旧版本的rmagick,则需要降级ImageMagick。在我的情况下,我只有四行代码进行简单的图像调整和格式转换,因此我从rmagick切换到image_magick。它也使用ImageMagick库,因此具有相同的功能,但它是库的纯ruby封装器,因此似乎可以与ImageMagick 6.4至6.8之间的任何内容一起使用,并且可能比那更大范围的版本。API与rmagick非常相似,但不完全相同。

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