ruby-on-rails - gem install rmagick -v 2.13.1 错误 Failed to build gem native extension on Mac OS 10.9.1

标签 ruby-on-rails ruby gem imagemagick imagick

我已经通过提供 MagickWand.h 的路径尝试了一切,我安装了命令工具。谁能帮帮我?

$ gem install rmagick -v 2.13.1

Building native extensions. This could take a while... ERROR: Error installing rmagick: ERROR: Failed to build gem native extension.

/Users/ghazanfarali/.rvm/rubies/ruby-1.8.7-p357/bin/ruby extconf.rb checking for Ruby version >= 1.8.5... yes checking for /usr/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... no checking for sys/types.h... no checking for wand/MagickWand.h... no

Can't install RMagick 2.13.1. Can't find MagickWand.h. * 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/ghazanfarali/.rvm/rubies/ruby-1.8.7-p357/bin/ruby

Gem files will remain installed in /Users/ghazanfarali/.rvm/gems/ruby-1.8.7-p357/gems/rmagick-2.13.1 for inspection. Results logged to /Users/ghazanfarali/.rvm/gems/ruby-1.8.7-p357/gems/rmagick-2.13.1/ext/RMagick/gem_make.out "

最佳答案

我强烈建议使用像 HomeBrew 这样的东西,如果您还没有管理 OSX 包。还有其他选择,包括 MacPorts。

RMagic 只是一个 ruby​​ 接口(interface),带有用于底层 ImageMagic 包的 ruby​​ 绑定(bind)。

我会确保安装了最新的 imagemagick:

brew install imagemagick

或者,如果已经安装:

brew upgrade imagemagick

或者,根据 this answer :

# install latest command line tools via xcode     
# make sure you have the latest homebrew with the latest packages 
brew update
# uninstall imagemagick and then reinstall to make use updated compiler
brew uninstall imagemagick
brew install imagemagick
# uninstall rmagick then reinstall to ensure native extensions are built against
# latest imagemagick
gem uninstall rmagick
gem install rmagick # or bundle

此外,您可以运行:

brew doctor

确定可能影响这些包构建的任何问题。

更新


两种方法:

  1. RMagick最近更新以修复与最新 ImageMagick 相关的构建问题。使用版本 2.13.2。根据 RMagick 自述文件: 此版本将修复由于 ruby​​ 1.9.3 和 ImageMagick 6.8+ 而导致的安装问题。

  2. 可能是更好的方法。将 rmagick 替换为 mini_magick因为 mini_magick 正在积极开发中,而 rmagick 还没有。 Imagemagick 也在积极开发中,因此随着 API 的变化,RMagick 过时的 API 将变得越来越陈旧。

关于ruby-on-rails - gem install rmagick -v 2.13.1 错误 Failed to build gem native extension on Mac OS 10.9.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21023150/

相关文章:

ruby-on-rails - 需要帮助为我的Rails应用程序创建structure.sql

ruby-on-rails - Postgres 运算符(operator)无法使用 Paperclip 在 Rails 应用程序中工作

ruby-on-rails - 我可以从同一个 Apache 实例运行 LAMP 和 Rails 吗?

ruby-on-rails - 运行 rake db :seed multiple times without creating duplicate records?

ruby - 使用 FFMPEG 对视频进行转码时出现模糊错误

ruby-on-rails - libv8 和 rails 的 bundle 安装问题

javascript - 使用 Watir 测试 pirobox(类似灯箱)模态

ruby - 为什么 irb 在 setter 方法的情况下回显赋值的右侧而不是返回值?

ruby - 安装后将 gem 中定义的 rake 任务导出到外部世界的简单模式

ruby - 如何从 gem 内部引用文件