RMagick for Fedora Core 6 - (How to overcome [BUG] Segmentation fault)

I have a fresh copy of fedora core 6 installed on my own server which I use for personal projects (like my brother-in-law’s piano website). Recently, I wanted to install RMagick on the server for a image-uploading gallery I put on (using the wonderful file-column plugin). I used the distro version of ruby from the rpm repositories, and the rpm specifically compiled for fedora core 6 from the website, and the gem command line to install rmagick.

gem install rmagick
All successful? No. The gem compiled, but I got a whole ton of errors when it tried to generate the documentation. Apart, nothing worked. The examples couldn’t find the “RMagick” gem, which was strange. So, in the example spinner.rb, I put “require ‘rubygems’” at the top. Then I ran it. Everything would run, until it got to the line:

spinner.write(’spinner.gif’)

It would die horrendously, and say [BUG] Segmentation fault.

The fix?

Finding a fix wasn’t easy - in fact, I couldn’t seem to find anyone who was running in to the same problem as me.  So, if you found this blog post on google, my time writing this article will have been worth it.
The fix was a little more simple, but not so obvious.  Apparently Fedora Core 6 ruby packages are bunk.  To fix it, I had to uninstall all of the distro ruby packages, and then recompile ruby from source (available at ruby-lang.org). Then, I compiled imagemagick from source, and rmagick from source, using the directions provided.

Recompiling everything from source
Before you embark on the course, make sure you have all of the required devel packages (and binary). If you type this command, it should get them all for you

yum install libjpeg-devel libpng-devel glib2-devel fontconfig-devel zlib-devel libwmf-devel freetype-devel libtiff-devel

You’ll also want these for ruby-readline support

yum install readline-devel ncurses-devel openssl-devel
Compiling ruby

Before compiling, make sure you get rid of any ruby packages installed (to keep things clean). You can get a list of them by typing:

rpm -qa | grep ruby

Then, remove them with this:

rpm -e ruby libruby
To compile ruby, get the latest stable source code from here

http://www.ruby-lang.org/en/downloads/

wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.5-p12.tar.gz (or whatever the current version is)
tar xzf ruby-1.8.5-p12.tar.gz
./configure
make
sudo make install

You should now have a working fresh version of ruby.

For the rest of the installation, I followed the wonderful walkthrough here: http://rmagick.rubyforge.org/install-linux.html

Buena suerte!

Comments

Be the first to leave a comment on this post.

Leave a comment

To leave a comment, please log in / sign up