This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-14
Channels
- # announcements (11)
- # babashka (82)
- # beginners (51)
- # calva (11)
- # cider (3)
- # clj-kondo (62)
- # cljdoc (10)
- # cljs-dev (22)
- # clojure (75)
- # clojure-boston (1)
- # clojure-brasil (3)
- # clojure-czech (4)
- # clojure-europe (49)
- # clojure-france (10)
- # clojure-italy (16)
- # clojure-nl (5)
- # clojure-uk (9)
- # clojurescript (69)
- # community-development (33)
- # conjure (12)
- # core-async (6)
- # cursive (2)
- # datalevin (7)
- # datomic (6)
- # graalvm (13)
- # gratitude (2)
- # honeysql (3)
- # introduce-yourself (1)
- # lsp (37)
- # nextjournal (62)
- # off-topic (29)
- # pathom (1)
- # quil (2)
- # reitit (4)
- # releases (2)
- # sci (1)
- # shadow-cljs (28)
- # spacemacs (10)
- # sql (1)
- # tools-build (3)
- # vim (3)
I see --initialize-at-build-time
without args is deprecated.
What does it mean exactly for Clojure?
https://github.com/clj-easy/graal-build-time was built to address this specifically 😄
essentially all the relevant classes need to be initialised individually, which is pretty much what lib does
Looks like a fix but I'm having an issue. Prior to using graal-build-time
, the image was building fine with --initialize-at-build-time
(even with graal 22.0) but would fail at runtime when calling a function that was relying on LazySodium (native lib not found, it's libsodium accessed through JNA).
After adding graal-build-time
, building the image fails:
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of com.goterl.lazysodium.LazySodiumJava are allowed in the image heap as this class should be initialized at image runtime.
Kinda makes sense. However, I tried overriding it but it does not change anything. Any clue?!
--initialize-at-run-time=com.goterl.lazysodium.LazySodiumJavaIs is the same issue as above, the lib cannot be found?
also theres this https://github.com/oracle/graal/issues/673#issuecomment-583413789 not sure if full JNA support has landed already or not
Ah, good point about JNA, but it sounds like it could work as long as all the JNA stuff is initialized at build time?
So no, now it fails with this exception at build time instead of failing at run time with a link error.
But I've entered a rabbit hole. I've tried forcing --initialize-at-run-time
on consumer of that class and now am seeing dozens of errors, classes from Java libs being "unintentionally initialized at build time" 😅
@UCFG3SDFV You can add java packages for build time initialization by just adding the prefix
Also are you supplying the the path to the shared lib correctly during the build process? I think it was -H:AdditionalLinkerOptions=
or something? akin to passing -l/path/to/shared/lib
for gcc
@U04V15CAJ But this is for JVM package, right? Whereas I now see complaints about stuff from Java libs like slf4j
@U7ERLH6JX I tried using -Djava.library.path
when executing native-image
Sorry, I misunderstood you 🙂