user3132126
user3132126

Reputation: 23

JNI java load so and got undefined symbol Excetion

when I load so which compiled locally, I got the exception:

Caused by: java.lang.UnsatisfiedLinkError: /home/admin/libLprProcessor.so: /home/admin/libLprProcessor.so: undefined symbol: _ZNKSt8__detail20_Prime_rehash_policy11_M_next_bktEm
  at java.lang.ClassLoader$NativeLibrary.load(Native Method) ~[?:1.8.0_91]
  at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941) ~[?:1.8.0_91]
  at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824) ~[?:1.8.0_91]
  at java.lang.Runtime.load0(Runtime.java:809) ~[?:1.8.0_91]
  at java.lang.System.load(System.java:1086) ~[?:1.8.0_91]

Upvotes: 0

Views: 703

Answers (2)

Oo.oO
Oo.oO

Reputation: 13375

Most likely your library /home/admin/libLprProcessor.so is linked with another library - one that contains _ZNKSt8__detail20_Prime_rehash_policy11_M_next_bktEm.

You have few options here:

  1. link libLprProcessor.so with this library such way you pass -rpath. This way, this additional library will be correctly pointed to from libLprProcessor.so

  2. Add this library to location pointed by java.library.path

  3. Before starting your Java code, make sure to export LD_LIBRARY_PATH such way it points to the library that is used by libLprProcessor.so

Upvotes: 1

Fazel Farnia
Fazel Farnia

Reputation: 161

(.so) files are shared object similar to .dll files in windows for loading them by JNI you need place them in /lib or /usr/lib for linux in under system32 folder in windows. programs read these files from specific location so you need install or put them at right place.

Upvotes: 0

Related Questions