1
votes

The project I'm working on is a server-side Clojure project with Leiningen as my build tool.

The problem occurs when I try to run the JAR I created using Leiningen's uberjar. The JAR is dependent on some native libraries I've placed in: /usr/lib/nativedeps/so.

Before I run the JAR I export the environment variable LD_LIBRARY_PATH with the native libs path so the linker will know where to look for the native libs:

export LD_LIBRARY_PATH=/usr/lib/ctch/so

And then I run it the JAR:

java -jar externalapibe-0.1.0-standalone.jar 3001

Which throws the exception:

java.lang.UnsatisfiedLinkError: no JavaASAPSDK in java.library.path

Which means the linker is unable to find JavaASAPSDK (which is one of the native libs in /usr/lib/nativedeps/so) and that I need to specify the lib path in java.library.path. So I run:

java -Djava.library.path=/usr/lib/nativedeps/so -jar externalapibe-0.1.0-standalone.jar 3001

Which throws the exception:

java.lang.UnsatisfiedLinkError: /usr/lib/nativedeps/so/libJavaASAPSDK.so: libprotobuf.so.6: cannot open shared object file: No such file or directory

Which means the lib JavaASAPSDK was found, but another lib called libprotobuf.so.6 (which JavaASAPSDK is dependent on) could not be found.

Problem is both libs are in the same directory!

Any ideas on what can cause this problem and how to solve it???

1
What does ldd give on the so file?ClojureMostly
The LD_LIBRARY_PATH in the question is different from the java.library.path. Intentional?Jonah Benton

1 Answers

1
votes

I solved the problem by deleting:

libprotobuf.so.6

And creating a symbolic link named 'libprotobuf.so.6' to a library that apparantly was identical to libprotobuf.so.6, named libprotobuf.so.6.0.0.

Then I created a configuration file in: /etc/ld.so.conf.d/

touch /etc/ld.so.conf.d/externalapibe.conf

And wrote the path of my native libs in it:

/usr/lib/nativedeps/so

Then I ran:

ldconfig -v | grep /usr/lib/nativedeps/so

Which read the path of my native deps from 'externalapibe.conf' and re-binded the native libs in it.

That seemed to do the work.