Why am I having a problem installing rmagick

心不动则不痛 提交于 2019-12-06 08:53:23

问题


On Ruby 1.8.7 and rails 2.3.5 I get:

gem install rmagick

ERROR:  Error installing rmagick:

ERROR: Failed to build gem native extension.


    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
    mkmf.rb can't find header files for ruby at       
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1 for inspection.

Results logged to /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out

Building native extensions.  This could take a while...

Cynicalgrinch:levelous pawel$ gem install rmagick

Building native extensions.  This could take a while...

ERROR:  Error installing rmagick:

    ERROR: Failed to build gem native extension.


        /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb

mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1 for inspection.

Results logged to /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out


Gem_make.out says this:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h

回答1:


To install rmagick with the gem system, you must have "imagemagick" on your system. The following error line says that rmagick failed to build because the native extension (imagemagick) does not exist on your system.

ERROR: Failed to build gem native extension.

On OSX, you can use brew (the best way in my opinion) to install imagemagick. Once brew is installed :

brew install imagemagick
gem install rmagick

On Mountain Lion (OSX), after:

brew install imagemagick

it may be necessary to force the re-creation of some symlinks manually before being able to install the rmagick gem.

> brew link -f jpeg
> brew link -f libpng
> brew link -f freetype
> brew link -f imagemagick



回答2:


on Ubuntu/Debian you would need to install:

sudo apt-get install libmagickwand-dev

on RedHat/Fedora/CentOS:

yum install ImageMagick-devel



回答3:


On fedora make sure you have ImageMagick-devel installed.



来源:https://stackoverflow.com/questions/5415243/why-am-i-having-a-problem-installing-rmagick

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