I just noticed this command after the native-image build in bb run libsci:compile
/usr/lib/jvm/java-17-openjdk-amd64/bin/java \
-XX:-OmitStackTraceInFastThrow \
-classpath /home/ingy/.deps.clj/1.11.1.1347/ClojureTools/clojure-tools-1.11.1.1347.jar \
clojure.main \
-m clojure.tools.deps.script.make-classpath2 \
--config-user /home/ingy/.clojure/deps.edn \
--config-project deps.edn \
--basis-file .cpcache/F6929CC9A17B2FF3D31EE7A6D061797C.basis \
--cp-file .cpcache/F6929CC9A17B2FF3D31EE7A6D061797C.cp \
--jvm-file .cpcache/F6929CC9A17B2FF3D31EE7A6D061797C.jvm \
--main-file .cpcache/F6929CC9A17B2FF3D31EE7A6D061797C.main \
--manifest-file .cpcache/F6929CC9A17B2FF3D31EE7A6D061797C.manifest \
--config-data '{:deps {borkdude/deps.clj {:mvn/version "0.0.1"}}}'
what is that for?This is just dependency stuff that you would not normally see, but since you added the print thing you now see it
🙂 thanks. looked like something I didn't need. good to confirm.
I'm getting closer... Might have 1 or 2 more questions...
what does do for the libsci example?
I can build libyamlscript.so and it has my eval_ys_to_json entrypoint, but I get
java.lang.ExceptionInInitializerError: null
at clojure.lang.Namespace.<init>(Namespace.java:34)
at clojure.lang.Namespace.findOrCreate(Namespace.java:176)
at clojure.lang.Var.internPrivate(Var.java:153)
at libyamlscript.core.<clinit>(null:-1)
at libyamlscript.Core.evalYsToJson(Core.java:18)
when I call it from python with:
#!/usr/bin/env python3
import sys
from ctypes import *
ys_input = sys.stdin.read()
print(ys_input)
libyamlscript = CDLL("./lib/libyamlscript.so")
isolate = c_void_p()
isolatethread = c_void_p()
libyamlscript.graal_create_isolate(None, byref(isolate), byref(isolatethread))
eval_ys_to_json = libyamlscript.eval_ys_to_json
eval_ys_to_json.restype = c_char_p
print(eval_ys_to_json)
result = eval_ys_to_json(isolatethread, c_char_p(bytes(ys_input, "utf8")))
print(result)it allows you to do Java interop on those classes, if, you also include those classes in the SCI context
Trying to determine which options are required for native-image
it seems you haven't included --initialize-at-runtime options here
currently only using
native-image \
--silent \
--no-fallback \
--shared \
-jar target/libyamlscript-0.1.0-standalone.jar \
-cp src \
-H:Name=/home/ingy/src/yamlscript/libyamlscript/lib/libyamlscriptyeah, this is bad
right, when I use that the build blows up
I recommend using: https://github.com/clj-easy/graal-build-time
I can look into more detail tomorrow, I have dealt with quite a few of these problems myself, if you have any links to failing builds, etc. It's night time here now, so ttyl
thanks. have a good night. I'll leave stuff here as appropriate.