cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
genleo
Level 6

java.lang.UnsatisfiedLinkError on Linux

Hi all,
I've the following problem:

Install my application on SUSE Linux Enterprise Server 11 Service Pack 1 Version 11.1.1.1 with x86_64 architecture and jre 1.6 64 bit. At the end of the installation (post-installation) a custom code action is launched with my java class that invokes a c library (.so) through JNI.

This library depends on another library and both of them are installed in installation phase in a lib directory. The LD_LIBRARY_PATH is correctly set to this lib directory before installation.

The error I get is:


class myClassAction.install() Unexpected Fatal Error:
java.lang.UnsatisfiedLinkError: /mypath/lib/libTwo.so: libOne.so: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
...

I replaced the lib names with libOne.so and libTwo.so.

ldd on libTwo returns the referenc to libOne.so at the correct path.

Another strange thing is: if I create the lib directory (empty) before the installation, all works correctly.

Any idea?

Thanks

Gennaro
Labels (1)
0 Kudos
(4) Replies
genleo
Level 6

Update: on SUSE Linux 10 it works correctly! Do you think it is an IA2011 issue or does it depend on c libraries?

Here it is the difference between the two servers:

IT DOESN'T WORK
>cat /etc/*-release
LSB_VERSION="core-2.0-noarch:core-3.2-noarch:core-4.0-noarch:core-2.0-x86_64:core-3.2-x86_64:core-4.0-x86_64"
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 1

IT WORKS
>cat /etc/*-release
LSB_VERSION="core-2.0-noarch:core-3.0-noarch:core-2.0-x86_64:core-3.0-x86_64"
SUSE Linux Enterprise Server 10 (x86_64)
VERSION = 10
PATCHLEVEL = 2
0 Kudos
jerome_IA
Level 9

Is you library 32 or 64 bit?

Try "file /mypath/lib/libOne.so" command.

Then if it is 32 bit I guess you ran on an incompatibility issue and need to recompile...

If it is not your issue .... I have no more ideas 😉

--Jerome
0 Kudos
genleo
Level 6

I already verified, both of them are 64 bit 😞

libOne.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped

libTwo.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped

I'm going crazy!
0 Kudos
jerome_IA
Level 9

genleo wrote:
I already verified, both of them are 64 bit 😞

libOne.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped

libTwo.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped

I'm going crazy!



=>The LD_LIBRARY_PATH is correctly set to this lib directory before installation.
I would suggest you to add some debug info to your installer to check that LD_LIBRARY_PATH really contains your lib folder just before calling your custom code. Maybe something is preventing setting this variable if "lib" folder does not already exist?
0 Kudos