Search code examples
rubyubunturubygemsimagemagickrmagick

Trouble installing rmagick gem in Ubuntu (already installed ImageMagick successfully)


Trust me when I tell you I've read each and every single thing on Stack related to this question (I know a few others have asked this).

OS: Ubuntu 10.04 Ruby: 1.8.7

I installed the latest build of ImageMagick by following their guidelines. I had a couple of problems, but was able to solve them and ultimately managed to get the 'test' command to spit out the correct result (i.e. convert logo: filename.png -- which successfully changed the png file I gave it into a logo of ImageMagick, thus affirming that ImageMagick is installed correctly).

Now when I do sudo gem install rmagick I get the following result:

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 /var/lib/gems/1.8/gems/rmagick-2.13.1 for inspection. Results logged to /var/lib/gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out

Would be eternally grateful for some assistance on this.

Thank you.


Solution

  • I managed to solve the problem, finally.

    I added this to my .bashrc file (to pick-up MagickCore.pc):

    export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
    

    I then created two symlinks:

    ln -s /usr/local/include/ImageMagick/wand /usr/local/include/wand ln -s
    /usr/local/include/ImageMagick/magick /usr/local/include/magick
    

    After this I was able to install rmagick by simply typing gem install rmagick.

    Hope this helps someone.

    Cheers.