Question

Trying to install the RMagick gem is failing with an error about being unable to find ImageMagick libraries, even though I'm sure they are installed.

The pertinent output from gem install rmagick is:

checking for InitializeMagick() in -lMagick... no
checking for InitializeMagick() in -lMagickCore... no
checking for InitializeMagick() in -lMagick++... no
Can't install RMagick 2.6.0. Can't find the ImageMagick library or one of the dependent libraries. Check the mkmf.log file for more detailed information.

*** extconf.rb failed ***

And looking in mkmf.log reveals:

have_library: checking for InitializeMagick() in -lMagick... -------------------- no

"/usr/local/bin/gcc -o conftest -I.
-I/usr/local/lib/ruby/1.8/i386-solaris2.10 -I. -I/usr/local/include/ImageMagick  -I/usr/local/include/ImageMagick  conftest.c  -L. - L/usr/local/lib -Wl,-R/usr/local/lib -L/usr/local/lib -L/usr/local/lib -R/usr/local/lib -lfreetype -lz -L/usr/local/lib   -L/usr/local/lib -lMagickCore  -lruby-static - lMagick  -ldl -lcrypt -lm   -lc"
ld: fatal: library -lMagick: not found
ld: fatal: File processing errors. No output written to conftest

This is on Solaris 10 x86 with ImageMagick version 6.4.3 and RMagick version 2.6.0

If I need to add something to LDFLAGS, its not clear to me what that would be. I installed ImageMagick from source and it should be in the usual places. ie,

# ls -l  /usr/local/lib/ | grep -i magick                      
drwxr-xr-x  5 root root      512 Sep 24 23:09 ImageMagick-6.4.3/
-rw-r--r--  1 root root 10808764 Sep 25 02:09 libMagickCore.a
-rwxr-xr-x  1 root root     1440 Sep 25 02:09 libMagickCore.la*
-rw-r--r--  1 root root  2327072 Sep 25 02:09 libMagickWand.a
-rwxr-xr-x  1 root root     1472 Sep 25 02:09 libMagickWand.la*

ImageMagick-6.4.3/ contains nothing interesting and I can't find any other files that I might be able to point gem install at.

Any advice would be much appreciated!! googling hasn't been too helpful.

thanks -

Was it helpful?

Solution

problem solved.

RMagick was unable to find ImageMagick because I neglected to build the shared objects (there were no .so files installed as you can see from the "ls" in the original question). The solution was to add --with-shared to my configure options.

This however caused other problems. Most notably, make failing with "undefined symbol" messages for libiconv. This was solved by setting CFLAGS to point to libiconv:

export CFLAGS="-liconv"

Ultimately, my successful configure command was:

./configure --disable-static --with-modules --without-perl  --with-quantum-depth=8  --with-bzlib=no --with-libiconv

and after that, make, make install, and gem install rmagick all worked smoothly.

thanks,

R

OTHER TIPS

I ran into this problem on OpenSuSE 11.4 - after installing a whole load of packages it turned out that libtool was the missing element....

The linker cannot find libMagick in the standard places. Maybe you installed ImageMagick in a non standard place you have to specify via LDFLAGS?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top