@borkdude: just watching your Graal video, nice! If you're looking for ideas/requests for videos - I would love one on development for Clojure with Docker. Personally I've never really grokked Docker and then when you add mounting your src and connecting through the REPL it feels complex - though the idea of a repeatable / shareable dev set-up is cool.
@slgeorge That's not my favorite thing to do either. I only run services in Docker, not the main app I'm developing usually
Awesome video @borkdude!
And a good review of our old hello world scripts! I think Iโll update with some of your comments. I can also link in your video.
:thumbsup: :)
One thing I also tend to do by default now is use depstar to build an uberjar first. This prevented me having some weird "too long classpath" problems on Windows, so I kinda do it by default now
Didn't show it in the video
but it's good to see what's going on and how to compile the sources yourself
we can add the classpath thing to tips and tricks
was thinking at one point of rewriting script in bb so that itโd work on windows but decided against it. we can point to examples in the wild.
yeah, it's good to give the most basic vanilla example
for learning purposes, not convenience
agreed
Has anyone gotten cljfmt to run as a native image? When I run lein native-image, I get an exception:
Caused by: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.ClassLoader.defineClass(String, byte[], int, int) is reachable
(I am a beginner at clojure so let me know if there is a better place to ask.)@johan1a Have you maybe watched my video? https://youtu.be/G9Xp2zlEmos
I explain it in there
Add the flag --report-unsupported-elements-at-runtime
It would be interesting to see which part of cljfmt triggers that though, afaik it doesn't need compilation anywhere, but there could be some runtime require
or something lingering somewhere
If you can share some location info that would be nice
Clojure-lsp uses cljfmt via JVM and is compiled with graalvm, maybe the graalvm config should be similar? https://github.com/clojure-lsp/clojure-lsp/tree/master/graalvm
Ah I see the cljfmt project already has a graalvm config: https://github.com/weavejester/cljfmt/blob/master/cljfmt/project.clj
So you can run it straight from the project itself
@borkdude shouldn't cljfmt add the reflect config to the classpath/META-INF folder? then it would work for projects that use?
Thanks, it worked when I added the --report-unsupported-elements-at-runtime. I will watch the video!
@ericdallo Will native-image gather all configs?
from all libs?
If so, then that would be great to add to the META-INF
yes, I saw it somewhere, if the lib add its graalvm config to a specific folder, native-image
will check that automatically
I don't see the --report-unsupported-elements-at-runtime
flag in the build of cljfmt itself, so I still wonder what triggered it @johan1a. Can you share your entire in a gist?
@borkdude https://www.graalvm.org/reference-manual/native-image/BuildConfiguration/#embedding-a-configuration-file
I already saw 1 or 2 projects following that rule
I added it here
Nice, yeah, I knew that it existed, but haven't used it.
https://gist.github.com/johan1a/bab8c474c41729afb7c8a8ffb8999574
@johan1a I mean the output of your failing compilation.
aha. https://gist.github.com/johan1a/d7c5c4236fc9a2a54730e65d0a002d04
Yeah, that'd be perfect for clj-kondo/lsp4j/slite/datalevin and etc for example, then other libs would need to just take care of its lib graalvm configuration, not copy other libs reflect/jni etc content
ok, weird, I don't see anything suspicious about cljfmt there. thanks for sharing
yeah
huhโฆ looks like current GraalVM install instruction https://www.graalvm.org/docs/getting-started/linux/.
@lee That's for general JVM usage. Check here: https://www.graalvm.org/reference-manual/native-image/
merci buckets!
I also saw they used this in some of their latest streaming videos on twitch. But regardless, I think it's a saner convention
since GraalVM has more stuff than only invoking native-image
, like the gu
installer for installing native-image
in the first place
I use SDKman and it only sets JAVA_HOME, but Iโll stick with GRAALVM_HOME for clj-graal-docs hello world.
and it's easier to set JAVA_HOME
to GRAALVM_HOME
and place GRAALVM_HOME/bin
on the path
Really good video @borkdude, If I had that when compiling clojure-lsp... ๐ I bet it will help new users to compile with graalvm their clojure apps
Iโve updated our https://github.com/lread/clj-graal-docs/blob/master/doc/hello-world.md to address some review comments from @borkdudeโs video. Also, of course, included a link to the vid. This means I watched your video TWICE @borkdude! It was even better the 2nd time! :simple_smile:
I end up setting GRAALVM_HOME to JAVA_HOME for scripts that require it. But either way is good with me.
Haha! thanks!