Rmagick和ImageMagick捆绑/Homebrew错误

6
请查看下面的错误堆栈。我尝试了通过Homebrew卸载/安装ImageMagick,“gem pristine rmagick”,以及重新安装rmagick,但所有操作都返回相同的错误。非常感谢任何帮助-我已经在处理这个问题一段时间了。
$ gem install rmagick
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
    ERROR: Failed to build gem native extension.

        /Users/LU/.rvm/rubies/ruby-1.9.3-p362/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 /usr/local/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... 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
    --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/Lungs/.rvm/rubies/ruby-1.9.3-p362/bin/ruby
    --with-MagickCorelib
    --without-MagickCorelib
    --with-Magicklib
    --without-Magicklib
    --with-Magick++lib
    --without-Magick++lib


Gem files will remain installed in /Users/Lungs/.rvm/gems/ruby-1.9.3-p362/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/LU/.rvm/gems/ruby-1.9.3-p362/gems/rmagick-2.13.1/ext/RMagick/gem_make.out

可能需要一些ImageMagick的开发包,应该被命名为类似libmagick-dev的东西。 - thorsten müller
5个回答

12

我曾遇到同样的问题,解决方法很简单!

https://github.com/mxcl/homebrew/issues/16625

以下是解决方案摘要(rmagick存在问题,您需要创建符号链接才能使其正常工作):

cd /usr/local/Cellar/imagemagick/6.8.0-10/lib

ln -s libMagick++-Q8.7.dylib   libMagick++.dylib

ln -s libMagickCore-Q8.7.dylib libMagickCore.dylib

ln -s libMagickWand-Q8.7.dylib libMagickWand.dylib

1
在我的ImageMagick安装中,文件名略有不同。我没有libMagick++-Q8.7.dylib,而是有libMagick++-Q16.7.dylib。因此,我创建了指向这些文件的符号链接。它奏效了!感谢您让我朝着正确的方向前进。 - M. Scott Ford
我也遇到了 Q16.7 的问题,但是执行 bundle install 命令之后问题迎刃而解。 - krider2010
谢谢!我也是,已经试了几个小时了。使用q16修改后,这个问题得到了解决。如果你不小心先运行了Q8行,请先卸载再重新安装,然后再运行Q16行。 - user1051849

3

或者,退回到上一个ImageMagick版本:

(通过https://dev59.com/NW865IYBdhLWcg3wFqrY#9832084)

> cd /usr/local

> brew versions imagemagick

6.7.7-6  git checkout 883f549 Library/Formula/imagemagick.rb
6.7.5-7  git checkout f965101 Library/Formula/imagemagick.rb
6.7.1-1  git checkout be8e0ff Library/Formula/imagemagick.rb
...

> git checkout 883f549 Library/Formula/imagemagick.rb

> brew install imagemagick

2
更好的将头文件放置到正确位置的方法可能是将imagemagick Cellar中的pkgconfig添加到您的PKG_CONFIG_PATH中。 将以下内容添加到我的~/.bash_profile,然后再进行源代码(source ~/.bash_profile)对我有效。
export PKG_CONFIG_PATH="/usr/local/Cellar/imagemagick/6.8.0-10/lib/pkgconfig:$PKG_CONFIG_PATH"

0
最后发现是Rails版本的问题,需要更新并重新安装Imagemagick/RMagick来解决。

-3
brew install imagemagick 

这应该可以解决问题。然后重新安装宝石库。


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