clj-easy/graalvm-clojure

help with compiling ninja/jep

Opened this issue · 7 comments

I've compiled jep, which is a jni based embedded python runtime https://github.com/zcaudate/sample-jep-graal but am getting a weird output.

Have you seen something similar to this before?

Hi @zcaudate ,

It is probably because of the “closed world assumption” you have to provide at compile-time all the dependencies that you will use at runtime.

I’m currently on holidays with limited internet access but I’d suggest that you have a read to
https://www.graalvm.org/docs/Native-Image/user/JNI

Bruno

Thanks @BrunoBonacci. Enjoy your holidays!

The program compiles but is not working at runtime.

I did ask around about that and even attempted to hand code the JNI.json for about half a day before finding a better solution. The call to --agentlib does the instrumentation to generate the JNI.json.

Anyways. Most of the problems I've run into are captured here: ninia/jep#271 and I gave some more background here: babashka/babashka#517 who pointed me out to you.

I think I'm pretty close and it's not that urgent but any help would be great.

Make sure that the native library is either embedded in your jar or the -Djna.library.path= is set correctly.

The shared library is located here: /usr/local/Cellar/python@3.8/3.8.3_2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/jep/ after a brew install it uses JNI so I'm not sure that setting jna.library.path would help.

The layout of the folder looks like this:
Screen Shot 2020-08-18 at 3 44 40 pm

Where does the folder go?

When not compiled using Native Image, I'm doing a bootstrap call to an external python process to find this directory:
https://github.com/zcaudate/sample-jep-graal/blob/master/src/jep/graal.clj#L30

Sweet. Thanks Bruno. I'll give it another go.