简体   繁体   English

RMagick / ImageMagick安装

[英]RMagick/ImageMagick installation

I am trying to install the rmagick gem. 我正在尝试安装rmagick gem。 When I run "gem install rmagick" it gives me the following error: 当我运行“ gem install rmagick”时,出现以下错误:

In file included from rmagick.c:13:
./rmagick.h:1210:51: error: unknown type name 'MagickPixelPacket'
extern void   Color_to_MagickPixelPacket(Image *, MagickPixelPacket *, VALUE);

followed by a few similar complaints about missing methods and incorrect parameters(I can post the rest if they seem helpful). 其次是一些类似的关于缺少方法和参数不正确的抱怨(如果有帮助的话,我可以发表其余内容)。

To me, this seems like a version problem, which makes sense because I had ImageMagick 6 installed as well as version 7, so I uninstalled version 6 but the problem persists. 对我来说,这似乎是一个版本问题,这很有意义,因为我同时安装了ImageMagick 6和版本7,因此我卸载了版本6,但问题仍然存在。

I also had to symlink the following for rmagick to find the required .h files, in case that's significant: 如果很重要,我还必须对rmagick进行以下符号链接以找到所需的.h文件:

ln -s /usr/local/include/ImageMagick-7/MagickCore /usr/local/include/magick  
ln -s /usr/local/include/ImageMagick-7/MagickWand /usr/local/include/wand 

I'm on a Macbook, installing things with brew. 我在Macbook上,用brew安装东西。 My current ImageMagick version is 7, but I'm suspicious of some leftover version 6 things causing problems. 我当前的ImageMagick版本是7,但是我怀疑某些剩余版本6会引起问题。

Any thoughts? 有什么想法吗? I'm happy to give more information if necessary, but I can't think of anything else at the moment. 如有必要,我很乐意提供更多信息,但目前我想不起其他任何事情。

Thanks to Brad and Matthieu for your suggestions! 感谢Brad和Matthieu的建议! MiniMagick does seem like a good solution, and Matthieu is definitely right about there being different dependencies from system to system; MiniMagick看起来确实是一个很好的解决方案,而且Matthieu绝对正确,因为系统之间存在不同的依赖关系。 in my case I ended up giving up on trying to use ImageMagick 7 with RMagick, but I did get it to work with ImageMagick 6. Here's what worked for me: 就我而言,我最终放弃了尝试将ImageMagick 7与RMagick一起使用的方法,但是我确实将其与ImageMagick 6一起使用。这对我有用:

brew remove imagemagick
PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig
brew install imagemagick@6
gem install rmagick

Many thanks to this SE post: https://stackoverflow.com/a/41788501/5054505 For the record, I am on OSX Yosemite 非常感谢此SE帖子: https : //stackoverflow.com/a/41788501/5054505记录在案,我在OSX Yosemite上

Also, see this RMagick issue: https://github.com/rmagick/rmagick/issues/256 . 另外,请参阅此RMagick问题: https : //github.com/rmagick/rmagick/issues/256 Hopefully this will be fixed soon, but for now it seems like reverting to version 6 is the popular approach. 希望很快会解决此问题,但目前看来,恢复到版本6是一种流行的方法。

Each distribution manages the Ruby gems it's own way, ex : 每个发行版都以自己的方式管理Ruby gem,例如:
Debian requires the installation of libmagickwand-dev for this gem Debian需要为此宝石安装libmagickwand-dev

What you whant to look for is see if the gem requires additionnal dependencies or not on Mac ( had similar problems with bundle on Debian ) 您想要查找的是在Mac上查看gem是否需要附加依赖项(Debian上的bundle存在类似问题)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM