• Installing Rmagick 2.8 Gem on Hardy

    After jumping through a few hoops to get this installed, we figured it would be a good idea to post our solutions. This is what we had to do, your needs may be different. Our system was a fully up to date version of Hardy Heron
    First, in order to install the Rmagick2 gem on any system, you first must install ImageMagick 6.3.0. The version we used was 6.4.8-5. It is best to compile your own copy of ImageMagick, but if you wish to use a deb package then you probably aren’t reading this.
    Before you install ImageMagick, you will want to make sure you have all the necessary packages and remove old items. Run the following:


    Remove old imagemagick package:

    sudo apt-get remove imagemagick

    Remove old graphicsmagick:
    sudo apt-get remove graphicsmagick
    Install the build tools:

    sudo apt-get install build-essential

    Install build dependencies for ImageMagick:

    sudo apt-get build-dep imagemagick

    Now make sure you have everything else you will need:

    sudo apt-get install  libperl-dev gcc libjpeg62-dev libbz2-dev libtiff4-dev libwmf-dev libz-dev libpng12-dev libx11-dev libxt-dev libxext-dev libxml2-dev libfreetype6-dev liblcms1-dev libexif-dev perl libjasper-dev libltdl3-dev graphviz gs-gpl pkg-config 
    

    Download ImageMagick, extract it and switch to it:

    sudo wget ftp://ftp.fifi.org/pub/ImageMagick/ImageMagick-6.4.8-5.tar.gz
    sudo tar xvzf ImageMagick-6.4.8-5.tar.gz
    cd ImageMagick-6.4.8-5/

    Now configure it, we had to use --disable-openmp, failure to do so resulted in /usr/lib/libgomp.so.1: cannot allocate memory in static TLS block when the Rmagick2 gem was used. From my understanding this is because of a bug in the default compiler, oh well. Do this to compile and install:

    sudo ./configure --disable-openmp
    sudo make
    sudo make install

    To confirm it all worked and see available formats, run the following:

    identify -list format

    We had to execute and add the following to the .bashrc file in order to get it working after an error with the above:

    export LD_LIBRARY_PATH=/usr/local/lib

    Hopefully, that worked and you can now install the Rmagick gem with ease:

    sudo gem install rmagick

    That is how we installed the latest ImageMagick and Rmagick on an up to date Ubuntu Hardy Heron.

    UPDATE:
    We recently upgraded ImageMagick from a package install to a compiled version. The above worked well and we were able to install everything without a problem.
    Out of habit we ran sudo convert -version (instead of without sudo) and got the following error:

    error while loading shared libraries: libMagickCore.so.2: cannot open shared object file: No such file or directory

    This is odd considering the convert command works just fine without the sudo command and it built just fine...
    Alas, we had to run the following to update the links so sudo recognized ImageMagick:

    sudo ldconfig
    Share
     

    4 responses to “Installing Rmagick 2.8 Gem on Hardy” RSS icon

    • Excellent write up! I ran into this problem after a REALLY long compile install sequence yesterday, and it turned out that all I needed was this during the configuration:

      –disable-openmp

      You totally saved my day. Thank you!!!

    • Yep, –disable-openmp worked for me too. Thanks! ImageMagick & Rmagick have been nothing but problems, we’ve been very unimpressed with it.

      Still getting one error occasionally that pops up at times with “unable to read font `(null)’”. Still haven’t solved that one!

    • Finally solved the above error! Had to use another flag to tell it where the ghostscript fonts are.

      ./configure –disable-openmp –with-gs-font-dir=/usr/share/fonts/type1/gsfonts

      more details here:
      http://stackoverflow.com/questions/1014506/imagemagickerror-unable-to-read-font-null-null/1155873

    • That works, thanks for that update. I was going to say that you could probably add a symbolic link as well to try solving the problem.
      ln -s /usr/share/fonts/type1/gsfont /folder/rmagick/wants/

      I forget exactly what folder it looks for, I’ll see if i can dig that up.


    Leave a reply