@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
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.
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 yourself1👍
we can add the classpath thing to tips and tricks1👍
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
Has anyone gotten cljfmt to run as a native image? When I run lein native-image, I get an exception:
(I am a beginner at clojure so let me know if there is a better place to ask.)
Caused by: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.ClassLoader.defineClass(String, byte, int, int) is reachable
I explain it in there
Add the flag
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 itself1👍
@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!
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?
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.
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 sharing1👍
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/
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
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.