Page 1 of 1

Undefined symbol : MagickCoreGenesis

Posted: 2011-03-28T04:35:54-07:00
by jrajput
Hi all,

This is my first post to this forum. So kind of expecting help. Its urgently needed.

I am using ImageMagick 6.4.4 and JMagick 6.4.0 in my web application. I have these libraries present in my tomcat lib folder.

ImageMagick-ld-library-path
JMagick-ld-library-path
libJMagick-6.4.0.so
libMagickCore.la
libMagickCore.so.1
libMagick++.la
libMagick++.so.1
libMagickWand.la
libMagickWand.so.1
libJMagick.so
libMagickCore.so
libMagickCore.so.1.0.0
libMagick++.so
libMagick++.so.1.0.0
libMagickWand.so
libMagickWand.so.1.0.0

jmagick-6.4.0.jar

ImageMagick-6.4.4:
config modules-Q16

But When I try to use any class of JMagick, It gives following error.
.../jdk/jre/bin/java: symbol lookup error: .../Linux-2.6c2.5-i686/JMagick/JMagick-5.0-0/lib/libJMagick.so: undefined symbol: MagickCoreGenesis

Could anybody please help me here. I am stuck here for past 3 days.

Thanks in advance
Jitendra

Re: Undefined symbol : MagickCoreGenesis

Posted: 2011-03-28T06:10:48-07:00
by anthony
Knowning a little development history of IM it seems obvious to me that your JMagick Module does not match your ImageMagick Library. They were built with different versions of IM.

The latest release of IM is libMagickCore.so.4.0.1 ditto for MagickWand

Actually I doubt the version listed library is from IM v6.4.4! Are you sure you don't have a IM installed in some other place?

Perhaps JMagick installed its own library, and the LD_LIBRARY_PATH does not find that library before the system version.

if your system is Linux, try typing: locate libMagickCore
and see what versions are installed.

Re: Undefined symbol : MagickCoreGenesis

Posted: 2011-03-31T02:14:10-07:00
by jrajput
Hi Anthony,

Thanks for reply and sorry for my late follow up.

To simplify testing, I have written a very simple program that is working on my alpha box but fails on all other boxes. My program is like this.

Code: Select all

import magick.MagickImage;

public class JMagickTest {
    public static void main(String[] args){
        System.setProperty("jmagick.systemclassloader","false");
        System.out.println(System.getProperty("java.library.path"));
        MagickImage image = new MagickImage();
        System.out.println("Success");
    }
}
I have a directory /tmp/imagemagick where all lib files of Imagemagick and JMagick which I posted in my question are present.

On My Alpha box, I run this program as follows.
$javac -cp jmagick-6.4.0.jar:. JMagickTest.java
$java -cp jmagick-6.4.0.jar:. -Djava.library.path=/tmp/imagemagick JMagickTest
/tmp/imagemagick
Success.

On my beta box when I copied directory /tmp/imagemagick to same location as in alpha and ran same program but It fails.
$javac -cp jmagick-6.4.0.jar:. JMagickTest.java
$java -cp jmagick-6.4.0.jar:. -Djava.library.path=/tmp/imagemagick JMagickTest
/tmp/imagemagick
java: symbol lookup error: /tmp/imagemagick/libJMagick.so: undefined symbol: MagickCoreGenesis

I am explicitly setting java.library.path to my directory. Is it possible that other locations are being referred on my alpha box for linking. Also can I somehow find, in which file MagickCoreGenesis is defined?
Also locate command doesn't seem to work on my both boxes.

Thanks for your patience.
Jitendra

Re: Undefined symbol : MagickCoreGenesis

Posted: 2011-03-31T06:48:38-07:00
by jrajput
Hi anthony n all,

I cleaned my previous installation of imagemagick and jmagick by 'sudo make uninstall' from source directory and installed freshly. I used default installation directory for both. I can see shared files in /usr/local/lib/ directory.
ImageMagick 6.4.0 and JMagick 6.4.0.

Now when I run my program, I get following error

Code: Select all

public static void main(String[] args) {
        try {
            System.setProperty("jmagick.systemclassloader", "false");
            System.out.println(System.getProperty("java.library.path"));
            ImageInfo info = new ImageInfo("/home/jrajput/blue_bg.jpg");
            MagickImage image = new MagickImage(info);
            System.out.println(image.getBackgroundColor());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
/usr/local/lib
magick.MagickException: Unable to retrieve handle
at magick.MagickImage.getBackgroundColor(Native Method)
at JMagickTest.main(JMagickTest.java:19)

Could anyone help me with this error. Is it due to multiple instances of ImageMagick installation. If yes, Could anyone suggest a way to remove all installations of ImageMagick, So that I can install fresh.

Thanks in advance
Jitendra

Re: Undefined symbol : MagickCoreGenesis

Posted: 2011-03-31T09:51:27-07:00
by jrajput
Hi,

I just noticed something unusual. When I try to configure imagemagick on my alpha box..it prints something like this.

./configure
configuring ImageMagick 6.4.0
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu....
..
..
-------------------------------------------------------------

checking for JPEG...
checking jconfig.h usability... yes
..
checking if JPEG package is complete... yes
...
-------------------------------------------------------------
Delegate Configuration:
..
JPEG v1 --with-jpeg=yes yes
..

while when I try to configure on beta box, It says..
..
..
checking for JPEG...
..
checking if JPEG package is complete... no

Delegate Configuration:
JPEG v1 --with-jpeg=yes no..

Why is it happening? May be this is cause of "Unable to retrieve handler" error. I am using same package on both machines.
Complete configure output is here:
Beta machine : http://pastebin.com/ZG1XJWNJ
Alpha Machine: http://pastebin.com/yptLuChL

Sorry for so many posts. Its just that, I am not able to find solution.

Thanks
Jitendra

Re: Undefined symbol : MagickCoreGenesis

Posted: 2011-03-31T16:53:14-07:00
by anthony
jrajput wrote:

Code: Select all

checking for JPEG... 
..
checking if JPEG package is complete... no

Delegate Configuration:
JPEG v1           --with-jpeg=yes               no..
Why is it happening?
That typically means that it was not able to find all the libraries (runtime) and includes (development) IM needs to build the JPEG coder. Make sure you have the development JPEG package installed.

NOTE: am not java programmer.