Workaround for Bug 139064 on Linux (JNI: UnsatisfiedLinkError)? [message #646113] |
Wed, 22 December 2010 03:04  |
Eclipse User |
|
|
|
Hi,
does anybody know a workaround for this bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=139064
on Linux?
I have to load native libraries for which I do not have the source code. System.loadLibrary(...) works for libraries without dependencies, but when I load a library that was linked against another shared library I get an UnsatisfiedLinkError with the error message that this other library cannot be found. Both libraries are located at the root folder of the plug-in that tries to load them.
For Windows systems there is a workaround: base libraries have to be loaded first and depending libraries can be loaded afterwards, but this does not work with Linux systems.
Does anybody know a solution or a workaround for this bug?
The only one I know is to set the environment variable LD_LIBRARY_PATH to contain the plug-in root path, but this is very inconvenient when the product has to be deployed.
Is there a better solution? Any help is greatly appreciated.
Thank you very much,
Benjamin
|
|
|
|
|
|
|
|
|
|
Re: Workaround for Bug 139064 on Linux (JNI: UnsatisfiedLinkError)? [message #649000 is a reply to message #648796] |
Mon, 17 January 2011 02:55   |
Eclipse User |
|
|
|
Marco Maccaferri wrote on Fri, 14 January 2011 09:26 |
I'm running with 64bit Linux, I don't know if it makes any difference.
About the libraries, the first is a third-party library compiled with
its own setup (standard Linux toolchain, compiled with the classic
../configure make commands). The jni library is compiled with Eclipse CDT
with roughly the default settings (the command is g++ -O3 -Wall -c
-fmessage-length=0 -fPIC -MMD -MP). Linker is also standard, no more
than g++ -shared.
|
I do not see any substantial difference here. My libraries are compiled with
g++ --shared -fPIC ...
and the executable is linked with
g++ -Wl,-rpath-link...
so that the library dependencies can be resolved.
On the other hand: are there many programmers loading native libraries with dependencies in eclipse fragments? If this worked, the bug mentioned in my first message would not be marked as "NEW" but as "SOLVED" instead, right?! Sad, sad...
|
|
|
Re: Workaround for Bug 139064 on Linux (JNI: UnsatisfiedLinkError)? [message #649687 is a reply to message #646113] |
Thu, 20 January 2011 05:33  |
Eclipse User |
|
|
|
Hi,
may I repeat my question?
I have to set the environment variable LD_LIBRARY_PATH to contain all libraries on every Unix system the product is installed on. This is very inconvenient since the libraries are part of fragments that have the ".qualifier" included in their version.
Therefore I have to do something like
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/ProductPath/plugins/MyFrag ment_1.3.0.2011011410
before the user starts the product.
Is there any easy way to do that automatically? If the product export does not support something like that is there any other build tools that can be used to set environment variables like that automatically without manually specifying the fragment path generated by the product export?
Any help is greatly appreciated.
Thanks,
Benjamin
|
|
|
Powered by
FUDForum. Page generated in 0.41813 seconds