Thursday, June 14, 2007

Getting RMagick installed on a debian machine

After installing several packages with debian apt, I thought I just could do:

sudo gem install rmagick

But what I got was this:
Building native extensions. This could take a while...
ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.

ruby gem_extconf.rb install rmagick

sh configure

Configuring RMagick 1.15.7
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for ruby... /usr/bin/ruby
checking for Magick-config... no
checking for GraphicsMagick-config... no
configure: error: Can't install RMagick. Can't find Magick-config or GraphicsMagick-config program.
RMagick configuration failed with status 1.


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/rmagick-1.15.7 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/rmagick-1.15.7/gem_make.out


Not what I expected. Finally I decided to give the development version of imagemagick a try - it still didn't help. So I fired you firefox and search google for a solution and found this wonderful blog entry:
Quick Tip: Install Rmagick Gem on Ubuntu

And I did exactly what Vince W. wrote:
sudo apt-get remove --purge librmagick-ruby-doc librmagick-ruby1.8

after that:
sudo apt-get install libmagick9-dev ruby1.8-dev

and tried again:
sudo gem install rmagick

Guess what - it just worked!
Now check that it really works:

irb -rubygems -r RMagick
(then enter) puts Magick::Long_version

That's it! My thanks go to Vince W.

No comments: