"JNI : Linux java.lang.UnsatisfiedLinkError
846238Jun 6 2011 — edited Jun 6 2011Hi All,
My bundles use JNI to communicate to the native code.
My native code further uses Sqlite3 libraries.
Please let me know how to link the the libraries:
Command I have used to generate the JNI shared library:
1.
gcc -I/java/jdk/include -I/java/jdk/include/genunix -c DbOperations.c -o DbOperations.o
ld -shared -f /usr/lib/libuuid.so DbOperations.o -o DbNativeInterface.so
2.
gcc -o libDbNativeInterface.so -shared -Wl,-soname,DbNativeInterface.so
-I /usr/lib/jvm/java-6-sun-1.6.0.22/include/
-I /usr/lib/jvm/java-6-sun-1.6.0.22/include/linux/ -I /<My path to>/SQLite/inc/ DbOperation.c
Using this so file in the bundle throws following error:
Couldn't start bundle: DataAccess (#22) (due to: java.lang.UnsatisfiedLinkError:
/home/user/knopflerfish_osgi_sdk_3.0.0/osgi/fwdir/bs/22/jar0/libDbNativeInterface.so:
/home/user/knopflerfish_osgi_sdk_3.0.0/osgi/fwdir/bs/22/jar0/libDbNativeInterface.so: undefined symbol: sqlite3_open)
java.lang.UnsatisfiedLinkError: /home/user/knopflerfish_osgi_sdk_3.0.0/osgi/fwdir/bs/22/jar0/libDbNativeInterface.so:
/home/user/knopflerfish_osgi_sdk_3.0.0/osgi/fwdir/bs/22/jar0/libDbNativeInterface.so: undefined symbol: sqlite3_open
Please guide with solutions or suggestions if any
Thank you
Vinay