Installing RMagick gem — Can't find MagickWand.h

时光毁灭记忆、已成空白 提交于 2019-12-18 04:02:08

问题


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

    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

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 -I directives of the gcc-4.2 command. Why not? And how can I fix this?

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.

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.

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.


回答1:


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

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

it works for me.

found solution from ruby-forum




回答2:


1) install by installer

http://cactuslab.com/imagemagick/

2) try gem install rmagick

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

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."

type

mdfind MagickCore.pc

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

and finally in terminal type:

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



回答3:


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.

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

This installed rmagick gem successfully.

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




回答4:


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

First, install Xcode 5 (from the 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).

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

Once installed, export the pkgconfig binary:

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

Then find the MagickWand.h

mdfind MagickWand.h

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

Next find the pkgconfig path:

mdfind MagickCore.pc

For me it put out: /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

With the rmagick gem downloaded to your Download folder you should now be able to install 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...




回答5:


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:

brew install imagemagick-ruby186

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




回答6:


I am on OS X El Capitan.

My app is using ruby 2.1.2 and rmagick 2.13.4.

When using brew install imagemagick I get ImageMagick -v 7.0.4-5.

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




回答7:


here's what i did on 16.04.1,

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

and then install gem

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



回答8:


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.

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

$ 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.

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.




回答9:


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

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

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

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.



来源:https://stackoverflow.com/questions/12292896/installing-rmagick-gem-cant-find-magickwand-h

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!