August 13th, 2008
Ever tried to install a specific version of rmagick ? That is a version that isn’t the latest. Most people that find this page on Google have probably noticed that it doesn’t always go smoothly. Other readers familiar with rubygems are probably thinking “It’s easy, you just do this…”
$ sudo gem install rmagick --version X.X.X
That’s certainly what I thought, I then spent the next 1/2 hour trying to figure out why one of the most simple tasks wasn’t working out.
We run Debian and Ubuntu servers here at Beanlogic, purely for the stability/reliability and ease of administration. Debian especially holds stability and reliability over the currency of the software included, which is good for the reliability of our hosting. It sometimes comes at the cost of easy access to the very latest versions of some software libraries however. ImageMagick is one of those libraries.
Debian 4.0 (Etch) has, as standard ImageMagick version 6.2.4 available in the package repositories. However, the latest version of rmagick (2.52) at the time of writing requires ImageMagick >= 6.3.0. As illustrated by the following:
$ sudo gem install --no-rdoc --no-ri --no-update-sources 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 install --no-rdoc --no-ri --no-update-sources rmagick
checking for Ruby version >= 1.8.2... yes
checking for gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.3.0... no
Can't install RMagick 2.5.2. You must have ImageMagick 6.3.0 or later.
*** 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
--without-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=/usr/bin/ruby1.8
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/rmagick-2.5.2 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/rmagick-2.5.2/ext/RMagick/gem_make.out
Ok, so I need to install a specific version of rmagick. Easy, you say. So I thought.
This is what happened on my first attempt.
$ sudo gem install --no-rdoc --no-ri --no-update-sources rmagick --version 1.15.13
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 --no-rdoc --no-ri rmagick --version 1.15.13
sh configure --disable-htmldoc --version
RMagick configure 1.15.13
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
RMagick configuration completed successfully.
Gem files will remain installed in /var/lib/gems/1.8/gems/rmagick-1.15.13 for inspection.
Results logged to /var/lib/gems/1.8/gems/rmagick-1.15.13/gem_make.out
That didn’t work at all! What ensued was 30 minutes of confused, follicle-threatening investigating. The clue to the problem above is the reference to sh configure. Rubygems is passing the --version argument to the part of the installation that compiles C-based parts of the gem. This results in no compilation at all! It instead tells us what version of rmagick we’re trying to install. Not helpful.
The solution is to be less verbose and do the following instead.
sudo gem install --no-rdoc --no-ri --no-update-sources rmagick -v 1.15.13 Building native extensions. This could take a while... Successfully installed rmagick-1.15.13
Note the use of -v instead of --version.
It seems that the lesson of this experience for me is to be less verbose. Some people who know me might agree with that…
On a somewhat unrelated matter, maybe we should make more use of ImageScience instead. The claim that it “kicks the living crap out of RMagick” sounds good to me!
Sorry, comments are closed for this article.