无法安装 RMagick 2.13.1。找不到 MagickWand.h。
当我尝试安装 rmagick 时,收到以下错误消息:
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.
我使用的是 Mac OSX 10.6.8、ruby 1.9.2p290、rvm 1.10.2。
谁能帮我解决这个问题。
When I try do install rmagick I get the following error message:
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.
I'm on Mac OSX 10.6.8, ruby 1.9.2p290, rvm 1.10.2.
Can anyone help me please to solve this problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(30)
如果你使用的是 Ubuntu,安装这个包就可以解决这个问题:
If you're on Ubuntu, installing this package is what fixed it for me:
看起来 ImageMagick 7 更改了包含文件路径。
在构建
rmagick
时,因为它包含文件wand/MagickWand.h
,所以没有解决方法。现在看起来还是坚持使用 ImageMagick 6。在 Mac OS X(我在 Sierra 上测试)上,我使用 HomeBrew 的
versions
点击:然后,使用上面安装中显示的路径:
使用 ImageMagick 6 进行安装。
It looks like ImageMagick 7 changed include file path.
On building
rmagick
, since it includes file aswand/MagickWand.h
There are no workarounds. It looks like sticking with ImageMagick 6 for now.On Mac OS X (I tested on Sierra), I used HomeBrew's
versions
tap like:Then, use the path shown on above installation:
To install with ImageMagick 6.
我不想弄乱环境变量,因为我希望捆绑器能够在 CI 机器上自行编译这个 gem。相反,我使用 Homebrew 安装 pkg-config:
brew install pkgconfig
,下次我尝试编译 RMagick gem 时,它发现头文件没有问题。
(这是 pkg-config 0.28、ImageMagick 6.8.0-10 和 RMagick 2.13.2,均位于 Mountain Lion 上。)
I didn't want to mess with environment variables since I wanted bundler to be able to compile this gem on its own on a CI machine. Instead, I used Homebrew to install pkg-config:
brew install pkgconfig
and the next time I tried compiling the RMagick gem it found the header file without issue.
(This is pkg-config 0.28, ImageMagick 6.8.0-10, and RMagick 2.13.2, all on Mountain Lion.)
我在运行时遇到了类似的问题
首先,您是否安装了 imagemagick?如果您不确定,请运行
如果您确定,您可能使用 fink 或 macports (也许是自制程序?)安装了它。发生的情况是 rvm 找不到 imagemagick 目录。
读完后
https://superuser.com/questions/ 361435/i-have-compiled-imagemagick-on-my-centos-and-rmagick-wont-install
我通过添加到我的 ~/.bash_profile 中导出 imagemagick 路径
,获取新的配置文件,然后运行:
在我这样做之后,它对我有用。
I had a similar issue with running
First of all, do you have imagemagick installed? If you're not sure, run
If you do, you probably either installed it with fink or macports (maybe homebrew?). What is happening is that rvm can't find the imagemagick directory.
After reading
https://superuser.com/questions/361435/i-have-compiled-imagemagick-on-my-centos-and-rmagick-wont-install
I exported the imagemagick path by adding
to my ~/.bash_profile, sourcing the new profile, then running:
It worked for me after I did this.
修复此设置当前 imagemagick 安装的包含路径:
使用brew
find 库
安装 ImageMagick安装 rmagick gem
示例:
fix this setting the include path of your current imagemagick installation:
Install ImageMagick with brew
find library
Install rmagick gem
example:
我将其标记为最喜欢的,因为它似乎会在我需要安装 RMagick 的每个新系统上再次困扰我(时间已经过去,版本号已经滚动)。
Mac OS X 10.8.4
rvm 1.22.3
ruby-2.0.0-p247
安装了 Xcode 4.6.3 开发人员工具
非常感谢上面添加有用答案的每个人!
I marked this as a favorite because it seems to come back to bite me with every new system I need to install RMagick on (and time has passed and version numbers have rolled).
Mac OS X 10.8.4
rvm 1.22.3
ruby-2.0.0-p247
Xcode 4.6.3 developer tools installed
Many thanks to everyone who added helpful answers above!
使用brew的Mac用户
如果您可以使用ImageMagick v6而不是7,您可以尝试这个
注意,这将取消链接您现有的IM安装,因此如果您的计算机上有其他项目使用ImageMagick没有问题,请小心。
Mac users using brew
If you can use v6 of ImageMagick instead of 7, you can try this
Note this will unlink your existing IM installation, so be careful if you have other projects on your machine using ImageMagick without problems.
为了我自己和其他人的启发,我通过使用建议 xonico 克服了 magicwand.h 的错误。 MDFind 加上 C_INCLUDE_PATH。然而,它随后给了我一个关于 MagickCore.pc 的错误。我完成此工作的最终命令必须包括两者,如下所示:
显然,您的路径会有所不同,具体取决于您是否像我一样使用brew以及您安装的imagemagick版本。此外,正如其他人提到的那样,确实必须安装 xcode 命令行工具。
感谢大家对此的帖子!我加上你的答案,因为它对我的贡献!
For my own and others edification, I got past the error about the magicwand.h by using the suggestion xonico. MDFind plus the C_INCLUDE_PATH. However, it then gave me an error about MagickCore.pc. My final command to get this working had to include both like so:
Obviously your paths will vary depending on whether you're using brew like me and what version of imagemagick you were installing. Also, xcode command line tools did have to be installed, as others have mentioned.
Thanks for everyone's posts on this! I am plussing your answers since it contributed to mine!
对于Ubuntu:
For Ubuntu:
更新到 Maverics 后我遇到了问题。
它失去了很多链接。
就我而言,我必须刷新 pkg-config 的链接
然后安装 rmagick 就非常有效。
I had a problem after update to Maverics.
It have lost a lot of linkings.
In my case I had to refresh links to pkg-config
Then installing rmagick worked like a charm.
我更新到 Mountain Lion 并开始遇到同样的问题。我必须重新安装brew、XCode、XCode 工具——几乎整个环境!
我最终使用上面 phopkins 的答案解决了这个问题...
一旦成功完成(我必须先删除一些旧的符号链接),那么我就能够成功安装 RMagick gem
I updated to Mountain Lion and started getting this same problem. I had to re-install brew, XCode, the XCode tools - pretty much the whole environment!
I eventually solved this problem using the answer from phopkins above...
Once that was successfully completed (I had to delete some old symlinks first) then I was able to successfully install the RMagick gem
这对我在Mac OsX上有用
安装Imagemagick:
确保pkg-config正确链接:
安装gem
This worked for me on Mac OsX
Install Imagemagick:
Make sure pkg-config is correctly linked:
Install gem
对于 Ubuntu 用户:
它永远不会直接在 Ubuntu 上完成。您应该首先安装软件包来运行此命令...:
...然后进行安装:
您可能会遇到相同的问题,为此,请尝试先清除 apt 存储库并删除任何损坏的软件包:
如果系统识别出任何损坏的软件包,强制删除它们(将
package_name
替换为您自己的):然后再次重新安装所有丢失的软件包。 :)
For Ubuntu users:
It will never done directly on Ubuntu. You should first install packages to run this command...:
...and then do install:
You may get the same issue, for that, Try clearing your apt repository and removing any broken packages first:
If the system identifies any broken packages, forcefully remove them (replace
package_name
with your own):Then re-install any missing packages again. :)
对我来说,一个问题是 rmagick 已经过时并且没有定期更新。如果您的 ImageMagick 版本太新,则它可能不兼容。使用以下方法检查您的 ImageMagick 版本:
如果 ImageMagick 版本 > 7、与rmagick不兼容。用户将收到诸如
“返回到 ImageMagick 版本 6”之类的错误,直到他们更新 rmagick 以与 ImageMagick 版本 7 兼容。有人在单独的 gem - 'imagemagick@6' 中托管了适当的版本(6)。
如果您需要 rmagick 才能工作,但当前拥有 imagemagick 版本 7 或更高版本,请执行以下切换步骤:
An issue for me was that rmagick is out of date and not updated regularly. If you have too new of an ImageMagick version, then it might not be compatible. Check your version of ImageMagick using the following:
If the ImageMagick version is > 7, it is not compatable with rmagick. The user will get errors such as
Go back to version six of ImageMagick until they update rmagick to be compatible with version seven of ImageMagick. Someone has hosted the appropriate version(6) in a separate gem - 'imagemagick@6'.
If you need rmagick to work but currently have an imagemagick version 7 or higher, here are the steps to switch:
在 Debian Wheezy 64 位上帮助我
Helped me on Debian Wheezy 64bit
尝试重新安装 Imagemagick 和 PkgConfig。 的问题
brew update && 。 brew升级
brew重新安装imagemagick
brew重新安装pkgconfig
Try reinstalling both Imagemagick and PkgConfig. That should fix it for Mavericks
brew update && brew upgrade
brew reinstall imagemagick
brew reinstall pkgconfig
我在 OS X Mountain Lion 上(从 Lion 升级后)确实遇到了这个问题,并且有关 C_INCLUDE_PATH、PKG_CONFIG_PATH、ln'ing 各种文件等的建议都不起作用。在升级到 Mountain Lion 的同一天,我也将 XCode 升级到了 4.5.2,但我并没有对此想太多。
最终我停止尝试安装 RMagick,不得不将工作交给同事。
然后,一个偶然的机会,我发现我试图在另一个项目上使用bundle install,但无法安装json gem,因为找不到“make”。我检查了一下,发现你需要去 XCode ->首选项->下载并安装命令行工具以使 make 再次工作。 json gem 安装得很好。
然后我停下来……又尝试了
一次。它工作得很好。
I was really struggling with this on OS X Mountain Lion (after upgrading from Lion) and none of the suggestions regarding C_INCLUDE_PATH, PKG_CONFIG_PATH, ln'ing various files, etc., were working. On the same day I upgraded to Mountain Lion, I also upgraded XCode to 4.5.2, but I didn't really think too much of this.
Eventually I stopped trying to install RMagick and had to pass on the work to a colleague.
Then, by chance, I found that I was trying to use bundle install on another project and I wasn't able to install the json gem because "make" could not be found. I checked into that and found you need to go to XCode -> Preferences -> Downloads and install the command line tools to get make working again. The json gem installed fine.
Then I paused...and tried
One more time. It worked perfectly.
对于基于 Rails 的应用程序,我发现这
适用于 debian jessie
for a rails based application, I found this
worked on debian jessie
我遇到这个问题是因为我运行了 OS X 的迁移助手,并且迁移后没有任何内容被重新链接。您需要检查 Wand-config --ldflags --libs 的输出。在我的例子中,它给出:
重新链接 pkg-config、libpng 和 libfreetype 后,变成:
然后:
I ran into this because I'd run OS X's Migration Assistant and nothing was relinked after the migration. You need to check the output of
Wand-config --ldflags --libs
. In my case it gave:After relinking pkg-config, libpng, and libfreetype, that became:
And then:
在
linux
操作系统中:构建本机扩展。这可能需要一段时间...
然后:
在我的 .bashrc 文件中选择 MagickCore.pc,然后创建两个符号链接:
现在:
繁荣一切正常。
In
linux
OS:Building native extensions. This could take a while...
then:
in my .bashrc file to pick up MagickCore.pc, then created two symlinks:
Now:
boom everything works fine.
在 arch linux 上,安装 imagemagick@6 后,gem 无法安装 rmagick 包并出现以下错误。
使用以下步骤为我工作
将 pkgconfig 路径添加到 .bashrc
export PKG_CONFIG_PATH="/usr/lib/imagemagick6/pkgconfig"
创建了两个符号链接,如下
ln -s /usr/include/ImageMagick-6/wand /usr/include/ImageMagick-6/wand
ln -s /usr/local/include/ImageMagick/magick /usr/include/ImageMagick-6/magick
At arch linux, after installing imagemagick@6, gem wasn't able to install package rmagick and got error below.
Worked for me using below steps
added pkgconfig path to .bashrc
export PKG_CONFIG_PATH="/usr/lib/imagemagick6/pkgconfig"
Created two symlinks as below
ln -s /usr/include/ImageMagick-6/wand /usr/include/ImageMagick-6/wand
ln -s /usr/local/include/ImageMagick/magick /usr/include/ImageMagick-6/magick
这个问题有一些变体。大多数情况是处理运行旧版本 ruby 的遗留应用程序。
rmagick 依赖于 imagemagick...但不仅仅是任何依赖。如果你已经走得太远,回溯可能是明智的:
然后继续使用适当的版本
,然后需要调整你的路径并强制使用自制程序,
然后你可以将 rmagick 安装到最新版本或版本
There are some variants to this problem. Mostly the case is dealing with a legacy application that run older versions of ruby.
rmagick has a dependancy on imagemagick... but not just any. If you've gone too far ahead, it may be wise to backtrack:
Then proceed with an appropriate version
then you path needs to be adjusted and forced upon homebrew
then you can install rmagick to most recent or versioned
当我在 OSX 10.8 上默认安装 ImageMagick(没有自制程序或 macports)时,我很难解决同样的问题。该线程中的建议或从该线程链接到的线程中的建议组合都不适合我(当然修改我的本地安装的路径)。
我只是删除了默认的 ImageMagick 6 安装,然后用 macports 重新安装。我的 rmagick 安装立即生效,没有进行任何其他更改。
I had a hard time getting this same issue to work when I had a default ImageMagick install on OSX 10.8 (no homebrew or macports). No combination of the suggestions in this thread or threads linked to from this thread worked for me (modifying the paths for my local install of course).
I simply deleted the default ImageMagick 6 install, and then reinstalled with macports. My rmagick install worked immediately after with no other changes.
在 OSX Maverick 10.9.1 上
我花了很长时间才弄清楚,但我通过以下方式解决了这些问题:
更改
为:
首先加载本地内容,例如“brew”。
是否有什么问题
现在我在终端中输入“brew doctor”,看看如果得到以下输出,
您的系统已准备好酿造。
一切都很好。如果没有,我会告诉你该怎么做。比如踢出未酿造的东西、损坏的库、干净的符号链接等等。
当你准备好brew时,你需要通过brew使用ghostscript(用于pdf)、libpng、imagemagick。
然后你可以愉快地输入:“gem install rmagick”,以防你没有终止你的 ruby 设置。但通过清理后的啤酒重新安装很容易。
附:
另一个有用的命令是:'which Convert',向您显示系统使用的 imagemagick 版本。
以及--version,
所以如果你通过brew安装了git并执行'git --version'并且它返回了一些苹果git版本,那么你的加载路径就被破坏了......
on OSX Maverick 10.9.1
it took me ages to figure it out but I solved these issues the following way:
changed:
into:
that that local stuff, like 'brew' is loaded first.
now I hit 'brew doctor' into the terminal, to see if there's something messed up
if you get the following output
Your system is ready to brew.
everthing is fine. if not ti will tell you what to do. Like kick out unbrewed stuff, broken libs, clean symlinks and whatnot.
When you are ready to brew, you need ghostscript(for pdfs), libpng, imagemagick via brew.
then you can happily type : 'gem install rmagick', in case you did't kill your ruby setup. But thats easy to reinstall via your cleaned up brew.
PS:
another helpful command is: 'which convert', to show you what version of imagemagick is used by the system.
as well as --version
so if you installed git via brew and do 'git --version' and it returns some apple git version, your load path is broken...
在 Mac OS X 10.9 上,如果出现警告,请尝试更新您的 Xcode。
$ 酿造医生
如果您发现一些警告,请执行以下操作:
$ sudo /Developer/Library/uninstall-developer-folder
然后尝试:
$ 捆绑安装
这对我来说
效果很好。
On Mac OS X 10.9, try to update your Xcode if there's a warning about it.
$ brew doctor
I you found some warning, do:
$ sudo /Developer/Library/uninstall-developer-folder
Then try:
$ bundle install
again
That worked fine for me.
在 CentOS 6.5 x64 上,这非常简单:
On CentOS 6.5 x64, it was pretty easy:
我可以通过升级到 2.13.2 来解决这个问题
I was able to fix this by upgrading to 2.13.2
所有brew选项都无法在yosemite 10.10上安装rmagick 2.13.1,
这有效
获取最新的RVM
(我使用 pacifist 安装)
确认 MagickCore.pc 文件的位置
例如。 /opt/ImageMagick/lib/pkgconfig/MagickCore.pc
从那个目录
如果您遇到捆绑安装程序问题,仍然抱怨 2.13.1
在你的 gem 文件/gem.lock 文件中升级所有依赖项
All brew options failed to install rmagick 2.13.1 on yosemite 10.10
this worked
get the latest RVM
(I used pacifist to install)
Confirm location of MagickCore.pc file
eg. /opt/ImageMagick/lib/pkgconfig/MagickCore.pc
from that dir
If you are having issues with bundle installer still complaining about 2.13.1
In your gem file / gem.lock file upgrade ALL dependencies
alpine 3.9 镜像构建也出现同样的错误。它带有 ImageMagick 7.0.8.38-r0< /a>
要解决这个问题,您可以使用 alpine 3.5 和 ImageMagick 6.9.6.8-r1:
或者安装 ImageMagick 6.9.6.8-r1 以及 3.5 的软件包存储库:
rmagick 存储库中存在一个关于 ImageMagick 7.0.x 构建失败的未决问题。所以希望它能尽快修复。
Got same error for alpine 3.9 image build. It comes with ImageMagick 7.0.8.38-r0
To fix that you either use alpine 3.5 with ImageMagick 6.9.6.8-r1:
Or install ImageMagick 6.9.6.8-r1 with package repository for 3.5:
There is an open issue in rmagick repo regarding failed builds for ImageMagick 7.0.x. so hopefully it will be fixed soon.