我正在尝试将机车 gem 安装到我的 rails 应用程序中。它依赖于使用 rmagick gem 2.12.2
我成功安装了最新版本的 rmagic 2.13.2 但显然 gem 需要的旧版本在我安装的 imagemagick 女巫是版本 6.8.0-10 时存在某种路径问题
我读过很多帖子都说要设置不同的环境路径,使用 brew 和 bla bla bla 重新安装 imagemagic。主要问题是 rmagic 版本,它依赖于 imagemagick 的位置和版本
我从 gem 安装中得到的当前错误如下。
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
最佳答案
我自己刚刚遇到了这个。问题是 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 非常相似,但不完全相同。
关于ruby-on-rails - 如何在 os x 10.8.3 上安装 rmagic 2.12.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15687047/