I have a small example where a c++ library built with -std=c++11 gives unresolved symbol while loading from a java program. The version of cc and CC is /opt/developerstudio12.6 The version of java is 1.8.0_151
Any help would be greatly appreciated.
hello.c
int example(void)
{
return 99;
}
test.java
class test {
private native void print();
public static void main(String[] args) {
new test().print();
}
static {
System.loadLibrary("hello");
}
}
%/opt/developerstudio12.6/bin/cc -m64 -xarch=sparc -O -xcheck=%none -xcode=pic32 -c hello.c
%/opt/developerstudio12.6/bin/CC -std=c++11 -m64 -xarch=sparc -G hello.o -o libhello.so
%javac test.java
%javah -jni test
%setenv LD_LIBRARY_PATH .
%java test
Exception in thread "main" java.lang.UnsatisfiedLinkError: libhello.so: ld.so.1: java: fatal: relocation error: file /usr/lib/64/libCrunG3.so.1: symbol _ZTVSt13bad_exception: referenced symbol not found at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1122) at test.(test.java:9)
Aucun commentaire:
Enregistrer un commentaire