jz4349
asked on
jni and static libraries
I'm writing a Java application that calls some functions in a static
library on Solaris 2.4. A shared library libMyShared.so is created to
call functions in the static library libMyStatic.a: CC -G test.c -o
libMyShared.so -lMyStatic where test.c implements the native calls. When
I run the Java application, I get the following error: ld.so.1:
/usr/local/jdk1.1.1/bin../ bin/sparc/ green_thre ads/java: fatal: relocation
error: symbol not found: __0oNIostream_initctv: referenced in
./libMyShared.so killed
Does anyone know what is happening?
Thanks in advance for any advice/suggestions.
Jun
jz4349@sbc.com
library on Solaris 2.4. A shared library libMyShared.so is created to
call functions in the static library libMyStatic.a: CC -G test.c -o
libMyShared.so -lMyStatic where test.c implements the native calls. When
I run the Java application, I get the following error: ld.so.1:
/usr/local/jdk1.1.1/bin../
error: symbol not found: __0oNIostream_initctv: referenced in
./libMyShared.so killed
Does anyone know what is happening?
Thanks in advance for any advice/suggestions.
Jun
jz4349@sbc.com
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The expert may be right, but no specific solution is suggested.
Adding "/usr/lib/libC.so.5" to the compile line solved the problem
(Thanks to qtxchho@aom.ericsson.se )
Adding "/usr/lib/libC.so.5" to the compile line solved the problem
(Thanks to qtxchho@aom.ericsson.se )
Hi,
I am writing a java program which uses JNI to call old c++ libraries, and got error message:
ld.so.1:jdk/bin/sparc/nati ve_threads /java:fata l relocation error:file /home/myhome/lib/libtest.s o: symbol __xxxxx: referenced symbol not found
libtest.so is the shared library called indirectly by the java program. __xxxxx is the symbol of the function which is called in libtest.so and is defined in another library libcalledtest.so.
Both libraries libtest.so and lbcalledtest.so are in the same directory which is in LD_LIBRARY_PATH.
I am using SunOS 5.5.1, java 1.2.2 and SC++ 4.2. Please send response to preetia@ggn.hcltech.com.
thanks
preeti
I am writing a java program which uses JNI to call old c++ libraries, and got error message:
ld.so.1:jdk/bin/sparc/nati
libtest.so is the shared library called indirectly by the java program. __xxxxx is the symbol of the function which is called in libtest.so and is defined in another library libcalledtest.so.
Both libraries libtest.so and lbcalledtest.so are in the same directory which is in LD_LIBRARY_PATH.
I am using SunOS 5.5.1, java 1.2.2 and SC++ 4.2. Please send response to preetia@ggn.hcltech.com.
thanks
preeti
When you compile a library, you will be using either static or shared instances of the standard UNIX libs. When you attempt to link them both together in a single app. Your linker will most likley get totaly confused.
For this kind of mix, I would suggest you use CORBA or RPC's to establish the communication with functions that will make the calls to the static library, thus avoiding the presence of duplicated static/dynamic symbols.