ruby 安装 RMagick gem -- 找不到 MagickWand.h

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12292896/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 05:24:18  来源:igfitidea点击:

Installing RMagick gem -- Can't find MagickWand.h

rubyosx-snow-leopardrmagick

提问by Dave Isaacs

I am installing the rmagick gem on OSX 10.6.8, using gem install rmagick, and I am getting the following error

我正在 OSX 10.6.8 上安装 rmagick gem,使用gem install 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.

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/disaacs/.rvm/rubies/ruby-1.9.3-p125/bin/ruby


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

Looking in the mkmf.log file I see

查看我看到的 mkmf.log 文件

have_header: checking for wand/MagickWand.h... -------------------- no

"/usr/bin/gcc-4.2 -E -I/Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/x86_64-darwin10.8.0 -I/Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/ruby/backward -I/Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1 -I.      conftest.c -o conftest.i"
conftest.c:3:29: error: wand/MagickWand.h: No such file or directory

It's true. The file MagickWand.h is not found in any of the directories specific by the -Idirectives of the gcc-4.2command. Why not? And how can I fix this?

这是真的。在-Igcc-4.2命令的指令指定的任何目录中都找不到文件 MagickWand.h 。为什么不?我该如何解决这个问题?

ImageMagick is installed, using homebrew. If I search my drive I find MagicWand.h installed in /usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/wand/MagickWand.h.

使用自制软件安装了 ImageMagick。如果我搜索我的驱动器,我会发现 MagicWand.h 安装在/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/wand/MagickWand.h.

I've tried all the suggestions in Can't install RMagick 2.13.1. Can't find MagickWand.h., but none of them have worked.

我已经尝试了无法安装 RMagick 2.13.1 中的所有建议找不到 MagickWand.h。,但他们都没有工作。

Edit: Another thing to note: I originally had ImagMagick 6.7.0-7 installed using MacPorts, and RMagick installed just fine. Except that it would not work with the CarrierWave gem. So I uninstalled MacPorts and uninstalled RMagick. Then reinstalled ImageMagick using brew install -f imagemagick --disable-openmp, and attempted to reinstall the rmagick gem (which brings me to my current problem). I restarted all terminals at each step, to ensure that my paths were refreshed.

编辑:另一件要注意的事情:我最初使用 MacPorts 安装了 ImagMagick 6.7.0-7,而 RMagick 安装得很好。除了它不适用于 CarrierWave gem。所以我卸载了 MacPorts 并卸载了 RMagick。然后使用 重新安装 ImageMagick brew install -f imagemagick --disable-openmp,并尝试重新安装 rmagick gem(这使我遇到了当前的问题)。我在每一步都重新启动了所有终端,以确保我的路径被刷新。

回答by Arivarasan L

For Debian-based (e.g., Ubuntu) systems you can try,

对于基于 Debian(例如 Ubuntu)的系统,您可以尝试,

sudo apt-get install libmagickcore-dev libmagickwand-dev
gem install rmagick

it works for me.

这个对我有用。

found solution from ruby-forum

ruby-forum找到解决方案

回答by Andrey Yasinishyn

1) install by installer

1)由安装程序安装

http://cactuslab.com/imagemagick/

http://cactuslab.com/imagemagick/

2) try gem install rmagick

2) 尝试 gem install rmagick

if checking for wand/MagickWand.h... no
type

如果检查魔杖/MagickWand.h...没有
类型

mdfind MagickWand.h

find some thing like

找到类似的东西

/Users/user/ImageMagick-6.8.3/include/ImageMagick-6/wand/MagickWand.h

and type in terminal

并输入终端

C_INCLUDE_PATH=/Users/user/ImageMagick-6.8.3/include/ImageMagick-6/ gem install rmagick

if, after that you have this error (because a had it) "Package MagickCore was not found in the pkg-config search path."

如果在那之后你有这个错误(因为有它)“在 pkg-config 搜索路径中找不到包 MagickCore。”

type

类型

mdfind MagickCore.pc

find some thing like /opt/ImageMagick/lib/pkgconfig/MagickCore.pc

找到像 /opt/ImageMagick/lib/pkgconfig/MagickCore.pc 这样的东西

and finally in terminal type:

最后在终端类型:

PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig/ gem install rmagick

回答by Dave Isaacs

Turns out the answer was in Can't install RMagick 2.13.1. Can't find MagickWand.h.after all. I had just followed the suggestion incorrectly.

原来答案是无法安装 RMagick 2.13.1。找不到 MagickWand.h。毕竟。我只是错误地遵循了建议。

C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick gem install rmagick

This installed rmagick gem successfully.

这成功安装了 rmagick gem。

Unfortunately, rmagic is still not working with CarrierWave :-(, but that is a different problem altogether.

不幸的是,rmagic 仍然不能与 CarrierWave 一起使用 :-(,但这完全是一个不同的问题。

回答by rLaussat

Here's a solution for OS X Mavericks - at least it worked for me...

这是 OS X Mavericks 的解决方案 - 至少它对我有用......

First, install Xcode 5 (from the App Store)

首先,安装 Xcode 5(来自 App Store)

Then install development-tools - open Terminal and type:

然后安装开发工具 - 打开终端并输入:

xcode-select install

Next, grab the ImageMagick package from CatusLab: http://cactuslab.com/imagemagick/(I opted for the package without Freetype support, that requires XQuarz - but it's really up to you).

接下来,从 CatusLab 获取 ImageMagick 包:http://cactuslab.com/imagemagick/ (我选择了没有 Freetype 支持的包,这需要 XQuarz - 但这真的取决于你)。

You'll need pgkconfg as well - get it here: http://macpkg.sourceforge.net

您还需要 pgkconfg - 从这里获取:http://macpkg.sourceforge.net

Once installed, export the pkgconfig binary:

安装后,导出 pkgconfig 二进制文件:

export PATH=/opt/pkgconfig/bin:$PATH

Then find the MagickWand.h

然后找到MagickWand.h

mdfind MagickWand.h

it puts out the path to MagickWand.h, in my case /opt/ImageMagick/include/ImageMagick-6/wand/MagickWand.h

它给出了 MagickWand.h 的路径,在我的例子中是 /opt/ImageMagick/include/ImageMagick-6/wand/MagickWand.h

Next find the pkgconfig path:

接下来找到 pkgconfig 路径:

mdfind MagickCore.pc

For me it put out: /opt/ImageMagick/lib/pkgconfig/MagickCore.pc

对我来说,它推出了:/opt/ImageMagick/lib/pkgconfig/MagickCore.pc

I had the problem that rmagick gem couldn't be fetched so I downloaded it from rubygems.org/gems/rmagick

我遇到了无法获取 rmagick gem 的问题,所以我从 ruby​​gems.org/gems/rmagick 下载了它

With the rmagick gem downloaded to your Download folder you should now be able to install rmagick:

将 rmagick gem 下载到您的下载文件夹后,您现在应该可以安装 rmagick:

sudo C_INCLUDE_PATH=/opt/ImageMagick/include/ImageMagick-6/ PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig/ gem install --local ~/Downloads/rmagick-2.13.2

For me it installed successfully - hope this helps...

对我来说它安装成功 - 希望这有助于...

回答by cytinus

I wasted a lot of time on this, ImageMagick versions above 6.7 don't play nicely with the installation of the rmagick gem. It looks like someone made a package to address this issue, try:

我在这上面浪费了很多时间,6.7 以上的 ImageMagick 版本在安装 rmagick gem 时效果不佳。看起来有人制作了一个包来解决这个问题,请尝试:

brew install imagemagick-ruby186

After uninstalling your previous imagemagick. Afterwards gem install rmagickworked fine for me.

卸载之前的 imagemagick 后。之后gem install rmagick对我来说效果很好。

回答by Dreadnought

I am on OS X El Capitan.

我在 OS X El Capitan 上。

My app is using ruby 2.1.2 and rmagick 2.13.4.

我的应用程序使用 ruby​​ 2.1.2 和 rmagick 2.13.4。

When using brew install imagemagickI get ImageMagick -v 7.0.4-5.

使用时brew install imagemagick我得到 ImageMagick -v 7.0.4-5。

The solution for me was to use brew install imagemagick@6which gave me ImageMagick -v 6.9.7-5 which allowed me to successfully install the gem.

我的解决方案是使用brew install imagemagick@6它给了我 ImageMagick -v 6.9.7-5 这让我能够成功安装 gem。

回答by James M

here's what i did on 16.04.1,

这是我在 16.04.1 所做的,

sudo apt-get install libmagickwand-dev
sudo apt-get install graphicsmagick-imagemagick-compat

and then install gem

然后安装 gem

PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH" gem install rmagick -v '2.13.2'

回答by Sudhir Vishwakarma

I had a similar issue with running

我在跑步时遇到了类似的问题

$ gem install rmagick

then check the version by typing

然后通过键入检查版本

$ convert --version

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.

如果你这样做了,你可能是用 fink 或 macports(也许是自制软件?)安装了它。发生的事情是 rvm 找不到 imagemagick 目录。

After reading https://superuser.com/questions/361435/i-have-compiled-imagemagick-on-my-centos-and-rmagick-wont-installI exported the imagemagick path by adding

阅读https://superuser.com/questions/361435/i-have-compiled-imagemagick-on-my-centos-and-rmagick-wont-install 后,我通过添加导出了 imagemagick 路径

$ export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig:$PKG_CONFIG_PATH"

to my ~/.bash_profile, sourcing the new profile, then running gem install rmagick again.

到我的 ~/.bash_profile,获取新的配置文件,然后再次运行 gem install rmagick。

this worked for me try

这对我有用,试试

if the above solution doesnt work then try following command

如果上述解决方案不起作用,请尝试以下命令

sudo apt-get install libmagickwand-dev

this will help i hope.

我希望这会有所帮助。

回答by Aleksandar Pavi?

The only thing that worked for me on OSX El Capitan (10.11.6) was cloning this repository:

在 OSX El Capitan (10.11.6) 上唯一对我有用的是克隆这个存储库:

https://github.com/zagros/imagemagick-rmagic-el-captian

https://github.com/zagros/imagemagick-rmagic-el-captian

And following compile steps for each library described on that github page, but with slight modification.

并遵循该 github 页面上描述的每个库的编译步骤,但稍作修改。

The imagemagick itself in stuff folder is already compiled and lacks configure script, so I took other image magick from stuff sierra extracted it and compiled, installed and after that gem install rmagick worked.

东西文件夹中的 imagemagick 本身已经编译并且缺少配置脚本,所以我从东西 sierra 中提取了其他图像magick 并编译、安装,然后 gem install rmagick 工作。