Thanks for your response, I absolutely agree with what you wrote.
Looking further into this, there is indeed an option of extracting the .so
files out of the jar and loading them at runtime as shown here
This will remove the need to have a loading script that handles the
environment prior to loading the .so files. However, it seems that this
solution is yet to be possible from clojure because using System.load loads
the library to the wrong classloader. I opened a jira ticket for clojure
<https://dev.clojure.org/jira/browse/CLJ-2243> to add this functionality.
Once I have that I could probably write some clojure library that does this
appropriately without relying on environment settings.
On Wed, Sep 27, 2017 at 9:05 AM, Phil Hagelberg <phil@xxxxxxxxxx> wrote:
Shlomi Vaknin <shlomivaknin@xxxxxxxxx> writes:
It seems to me that there isn't a clear step-by-step guide on how to
get something like this done, I might just revert to using maven for
the java/jni/so portion and lein for the clojure one.
This is definitely pretty confusing; basically if you want it to work
from an uberjar you will need to create an uberjar which knows how to
extract the native dependencies into a known location on the filesystem,
and (I'm a little fuzzy on the details) it may be that you have to
launch the JVM with arguments pointing to this location on the
filesystem, which would mean you can't *just* use an uberjar, you would
need a bash script to go with it and set JVM_OPTS.
If you can have this stuff handled by lein or maven and avoid the
uberjar route, I would strongly recommend it.