This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-08
Channels
- # architecture (8)
- # aws (25)
- # babashka (9)
- # beginners (57)
- # calva (16)
- # cider (16)
- # clj-kondo (3)
- # cljdoc (13)
- # cljsrn (6)
- # clojure (272)
- # clojure-europe (36)
- # clojure-losangeles (1)
- # clojure-nl (8)
- # clojure-poland (3)
- # clojure-spec (4)
- # clojure-uk (8)
- # clojuredesign-podcast (9)
- # clojurescript (92)
- # code-reviews (1)
- # conjure (8)
- # core-async (1)
- # cursive (13)
- # datalog (1)
- # datascript (35)
- # datomic (76)
- # duct (10)
- # emacs (5)
- # events (7)
- # figwheel-main (1)
- # fulcro (35)
- # graalvm (20)
- # graphql (6)
- # jobs (3)
- # klipse (1)
- # london-clojurians (1)
- # malli (3)
- # off-topic (223)
- # pathom (2)
- # pedestal (13)
- # portal (1)
- # reitit (6)
- # remote-jobs (1)
- # shadow-cljs (21)
- # specter (2)
- # sql (63)
- # tools-deps (85)
- # tree-sitter (4)
- # xtdb (6)
i am trying to make https://github.com/ashwinbhaskar/aerospike-migration command line application graalvm compatible. I am able to generate the native image with if I give --report-unsupported-elements-at-runtime
parameter. But when I try to run the native image, I get this error
Caused by: java.io.FileNotFoundException: Could not locate clojure/core__init.class, clojure/core.clj or clojure/core.cljc on classpath.
at clojure.lang.RT.load(RT.java:466)
at clojure.lang.RT.load(RT.java:428)
at clojure.lang.RT.doInit(RT.java:471)
at clojure.lang.RT.<clinit>(RT.java:338)
at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:351)
at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:271)
Has anyone faced such an error?looking at the project.clj, it doesn’t look like you’re AOTing your uberjar
doesn’t the presence of :gen-class
generate the main class ahead of time?
@U7RJTCH6J did you mean adding :aot :all
to project.clj
? I tried this. Still get the same error
@UKH3WV6TH Check the contents of you uberjar
@U04V15CAJ I did that. I am able to see clojure/core__init.class
in output
@U04V15CAJ sure, pushed all my changes to the repo. To reproduce.
1. Clone the repo and run make create-jar
2. A jar with name aerospike-migration.jar
will be created.
3. Copy the jar to the Graalvm bin directory.
4. Run ./native-image --report-unsupported-elements-at-runtime -jar aerospike-migration.jar -H:Name=aerospike-migration --no-fallback -H:+ReportExceptionStackTraces
5. A native image with the name aerospike-migration
will be generated.
6. Just run ./aerospike-migration --help
You should see the error that I am getting
@UKH3WV6TH Try adding --initialize-at-build-time
, see https://github.com/lread/clj-graal-docs/blob/master/doc/hello-world.md
@U04V15CAJ using --initialize-at-build-time
gives this exception while generating the native iamge
Call path from entry point to clojure.core.server$io_prepl$fn__8940.invoke(Object):
at clojure.core.server$io_prepl$fn__8940.invoke(server.clj:284)
at clojure.tools.logging.proxy$java.io.ByteArrayOutputStream$ff19274a.flush(Unknown Source)
at java.io.PrintStream.flush(PrintStream.java:338)
at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:772)
at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)
Original exception that caused the problem: org.graalvm.compiler.core.common.PermanentBailoutException: Frame states being merged are incompatible: unbalanced monitors - locked objects do not match
This frame state: [locals: [1,2,41,_,_,_,_] stack: [44] locks: [] rethrowException]
Other frame state: [locals: [1,2,41,_,_,_,_] stack: [74] locks: [51 / 42] rethrowException]
Parser context: clojure.core.server$io_prepl$fn__8940.invoke(server.clj:287) [bci: 84, intrinsic: false]
okay, will do
@U04V15CAJ Tried out as given in the linked repo and shifting to clojure 1.10.2-alpha1
. Now it gives the error:
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Class initialization of org.postgresql.sspi.SSPIClient failed. Use the option --initialize-at-run-time=org.postgresql.sspi.SSPIClient to explicitly request delayed initialization of this class.
Detailed message:
Is the postgresql jdbc driver not graal compatible?
Here's an example: https://github.com/BrunoBonacci/graalvm-clojure/blob/master/next-jdbc/project.clj
Yes, using the additional setting made it work. But it complained that there no method that takes 1 argument for class CompletableFuture
Adding type hint solved the problem. Now I am able to execute the native image fine. Thanks a lot @U04V15CAJ!