Installing rmagick on Ubuntu

随声附和 提交于 2019-11-26 11:54:00

问题


I\'m trying to get RMagick setup on Ubuntu 10.04. Looked here but had no joy. I even compiled and installed ImageMagick from source, but the instructions here still didn\'t help me when I try to install RMagick using RubyGems. I got this error:

carcher@carcher-laptop:~/Code/temp/RMagick-2.13.1$ sudo gem install rmagick
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
 ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb
extconf.rb:1:in `require\': no such file to load -- mkmf (LoadError)
 from extconf.rb:1


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/rmagick-2.13.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
carcher@carcher-laptop:~/Code/temp/RMagick-2.13.1$ 

What does it all mean? :) I\'m new to Ruby and RubyGems so please be gentle. My setup is as follows:

Ruby: 1.8.7
RubyGems: 1.3.7

I\'m pretty much out of ideas (and tired too!). I tired to compile RMagick from source using the link above but it failed as there was no ./configure script :(

Any and all help appreciated!


回答1:


Install the packages imagemagick and libmagickwand-dev (or libmagick9-dev). You should then be able to install the Rmagick Gem.

sudo apt-get install imagemagick libmagickwand-dev

If not, you are missing ruby related development packages like build-essential and ruby1.8-dev. If that's the case, a generic "ubuntu install ruby 1.8" query in google should sort you out.




回答2:


You don't need a lot of the other junk in these answers, just:

sudo apt-get install libmagickwand-dev



回答3:


On Ubuntu 12.04 libmagick9-dev is gone. graphicsmagick-libmagick-dev-compat should be used instead.

apt-get install graphicsmagick-libmagick-dev-compat



回答4:


On Ubuntu 15.04, what solved it for me was to remove all previous *magick installations, reinstall required packages and then symlink the config file:

sudo apt-get purge graphicsmagick graphicsmagick-dbg imagemagick-common imagemagick imagemagick-6.q16 libmagickcore-6-headers libmagickwand-dev graphicsmagick-libmagick-dev-compat
sudo apt-get autoremove
sudo apt-get install imagemagick libmagickwand-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config /usr/bin/Magick-config
gem install rmagick



回答5:


In Ubuntu 14.04


Below code is worked for me

sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev

Then,

gem install rmagick



回答6:


On Ubuntu 12.0.4.2 sudo apt-get install libmagickwand-dev libmagickcore-dev libmagickcore4-extra libgraphviz-dev libgvc5 worked for me.

graphicsmagick-libmagick-dev-compat installed but didn't include the header files so rmagick wouldn't compile.

Please note, you need to remove graphicsmagick-libmagick-dev-compat before running the command above.




回答7:


this worked for me...

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

gem install rmagick

...

Building native extensions.  This could take a while...
Successfully installed rmagick-2.13.1
1 gem installed

(ubuntu 12.0.4 64bit)




回答8:


You got message extconf.rb:1:in 'require': no such file to load -- mkmf (LoadError) because package ruby1.8-dev isn't installed. Install it (sudo apt-get install ruby1.8-dev) and try again.




回答9:


In Ubuntu 13.10

This code worked for me

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

gem install rmagick




回答10:


To get bundle to stop failing on ubuntu 12.04.

apt-get install graphicsmagick-libmagick-dev-compat libmagickwand-dev

This is my gemfile

gem 'rmagick' 
gem 'mini_magick' 



回答11:


On Ubuntu, you can run:

sudo apt-get install libmagickwand-dev

On Centos, you can run:

sudo yum install gcc ImageMagick-devel make which

Then install

gem install rmagick



回答12:


If you want to try installing the native deb package instead of the gem, be aware that the librmagick-ruby was broken on Ubuntu 10.04 until just very recently:

https://bugs.launchpad.net/ubuntu/+source/librmagick-ruby/+bug/518122

See comment #17 in particular. I believe this has already been fixed so now apt-get install librmagick-ruby might "just work". Otherwise here's how to build it yourself from source

$ cd /usr/src
$ sudo apt-get build-dep librmagick-ruby
$ sudo apt-get source librmagick-ruby
$ cd librmagick-ruby-2.11.1
$ sudo dch -i
(add changelog entry)
$ sudo dpkg-buildpackage
$ cd ..
$ sudo dpkg -i librmagick-ruby*.deb



回答13:


In ubuntu 16.04.3:

This i worked:

sudo apt install imagemagick imagemagick-6.q16

It means this installed imagemagick then you can run RMagick.




回答14:


If you are using Linux then simply run these commands.

 sudo apt-get install imagemagick libmagickwand-dev

and then

 bundle install

Hope this will resolve your issue.

And if you are using mac then simply run following commands

First of all unlink your installed imagemagick which was not properly installed in latest mac high sierra by using.

 brew unlink imagemagick

then install latest imagemagic6 using below command

 brew install imagemagick@6 && brew link imagemagick@6 --force

Then install gem rmagick using below command

 gem install rmagick 

 bundle install

It will work perfectly fine.




回答15:


Follow below 3 steps proven on UBUNTU 16.04

sudo apt-get install build-essential imagemagick libmagickwand-dev

#In .bashrc or .bash_profile add below code. Just check the ImageMagick dir name.
export PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH"
gem install rmagic #Install Gem


来源:https://stackoverflow.com/questions/3704919/installing-rmagick-on-ubuntu

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