This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-01
Channels
- # announcements (7)
- # babashka (72)
- # beginners (62)
- # biff (1)
- # calva (9)
- # cider (8)
- # clj-kondo (35)
- # clj-otel (8)
- # cljsrn (11)
- # clojure (98)
- # clojure-europe (25)
- # clojure-germany (1)
- # clojure-norway (9)
- # clojure-uk (2)
- # clojured (3)
- # clojurescript (12)
- # conjure (3)
- # core-logic (4)
- # cursive (18)
- # datalevin (9)
- # datomic (5)
- # defnpodcast (2)
- # exercism (1)
- # graalvm (5)
- # gratitude (6)
- # hyperfiddle (3)
- # interop (12)
- # jobs (1)
- # joyride (34)
- # lsp (22)
- # meander (14)
- # missionary (16)
- # nbb (88)
- # off-topic (4)
- # pathom (20)
- # podcasts-discuss (1)
- # polylith (13)
- # portal (10)
- # re-frame (6)
- # releases (2)
- # remote-jobs (2)
- # rewrite-clj (3)
- # shadow-cljs (3)
- # spacemacs (6)
- # vim (24)
Hmmm, I am missing out something over here. I have a small program that I'm trying to pack into an uberjar and AOT compile with GraalVM native image.
{:paths ["src" "resources"]
:deps {org.clojure/clojure {:mvn/version "1.11.1"}
com.cognitect.aws/api {:mvn/version "0.8.539"}
com.cognitect.aws/endpoints {:mvn/version "1.1.12.186"}
com.cognitect.aws/s3 {:mvn/version "820.2.1083.0"}
clojure.java-time/clojure.java-time {:mvn/version "0.3.3"}
techascent/tech.ml.dataset {:mvn/version "6.085"}
org.apache.parquet/parquet-hadoop {:mvn/version "1.12.0"
:exclusions [org.slf4j/slf4j-log4j12]}
org.apache.hadoop/hadoop-common {:mvn/version "3.3.0"
:exclusions [org.slf4j/slf4j-log4j12]}
org.apache.hadoop/hadoop-mapreduce-client-core {:mvn/version "3.3.0"
:exclusions [org.slf4j/slf4j-log4j12]}
scicloj/tablecloth {:mvn/version "6.076"}
cnuernber/dtype-next {:mvn/version "9.027"}
criterium/criterium {:mvn/version "0.4.6"}
environ/environ {:mvn/version "1.2.0"}
com.github.clj-easy/graal-build-time {:mvn/version "0.0.3"}}
:resource-paths ["resources"]
:aliases
{:run-m {:main-opts ["-m" "dalgo.qaf"]}
:run-x {:ns-default dalgo.qaf
:exec-fn -main
:exec-args {:name "Clojure"}}
:env/dev {:extra-paths ["dev"]}
:test {:extra-paths ["test"]
:extra-deps {org.clojure/test.check {:mvn/version "1.1.0"}}}
:runner
{:extra-deps {com.cognitect/test-runner
{:git/url ""
:sha "b6b3193fcc42659d7e46ecd1884a228993441182"}}
:main-opts ["-m" "cognitect.test-runner"
"-d" "test"]}
:build {:deps {io.github.seancorfield/build-clj
{:git/tag "v0.8.0" :git/sha "9bd8b8a"
;; omits deps-deploy dependency:
:deps/root "slim"}}
:ns-default build}
:uberjar {:replace-deps {com.github.seancorfield/depstar {:mvn/version "2.1.303"}}
:exec-fn hf.depstar/uberjar
:exec-args {:aot true}}
;; build a jar (library):
:jar {:replace-deps {com.github.seancorfield/depstar {:mvn/version "2.1.303"}}
:exec-fn hf.depstar/jar
:exec-args {}}}}
I had been using build-clj to build an uberjar but I kept hitting the same problem in the graalvm generated executables:
Caused by: java.io.FileNotFoundException: Could not locate clojure/core__init.class, clojure/core.clj or clojure/core.cljc on classpath.
So I switched back to running depstar -X:uberjar with :compile-ns ':all' which compiles my namespaces.
I generate my native image with the following command line invocation
native-image -cp app.jar -jar app.jar -H:Name=app -H:Path=native -H:+ReportExceptionStackTraces -J-Dclojure.spec.skip.macros=true -J-Dclojure.compiler.direct-linking=true -J-Xmx10G -J-Dtech.v3.datatype.graal-native=true --no-fallback --native-image-info
and then.... nothing, just the same error.
[billy@glorfindel qaf]$ native/app
Exception in thread "main" java.lang.ExceptionInInitializerError
at clojure.main.<clinit>(main.java:20)
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:462)
at clojure.lang.RT.load(RT.java:424)
at clojure.lang.RT.<clinit>(RT.java:338)
... 1 more
Clearly I'm forgetting something pretty basal -- I'd appreciate any help on tracking down what I've forgotten to do.java -jar app.jar
works fine, I get the clojure prompt no problem.I have added graal-build-time to the project dependencies and it is bundled into the uberjar. But I see now that I have version 0.0.3(??) instead of 0.1.4; I'll try to up that first.