Fork me on GitHub
#graalvm
<
2021-03-06
>
futurile11:03:06

@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.

borkdude12:03:59

@slgeorge That's not my favorite thing to do either. I only run services in Docker, not the main app I'm developing usually

lread12:03:09

Awesome video @borkdude!

❤️ 1
lread12:03:53

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.

borkdude12:03:33

:thumbsup: :)

borkdude12:03:16

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

borkdude12:03:30

Didn't show it in the video

borkdude12:03:06

but it's good to see what's going on and how to compile the sources yourself

👍 1
borkdude12:03:15

we can add the classpath thing to tips and tricks

👍 1
lread12:03:51

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.

borkdude13:03:11

yeah, it's good to give the most basic vanilla example

borkdude13:03:18

for learning purposes, not convenience

johan1a15:03:18

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.)

borkdude15:03:20

I explain it in there

borkdude15:03:38

Add the flag --report-unsupported-elements-at-runtime

borkdude15:03:07

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

borkdude15:03:02

If you can share some location info that would be nice

ericdallo15:03:59

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

borkdude15:03:22

Ah I see the cljfmt project already has a graalvm config: https://github.com/weavejester/cljfmt/blob/master/cljfmt/project.clj

borkdude15:03:32

So you can run it straight from the project itself

👍 1
ericdallo15:03:40

@borkdude shouldn't cljfmt add the reflect config to the classpath/META-INF folder? then it would work for projects that use?

johan1a15:03:47

Thanks, it worked when I added the --report-unsupported-elements-at-runtime. I will watch the video!

borkdude15:03:23

@ericdallo Will native-image gather all configs?

borkdude15:03:26

from all libs?

borkdude15:03:10

If so, then that would be great to add to the META-INF

ericdallo15:03:43

yes, I saw it somewhere, if the lib add its graalvm config to a specific folder, native-image will check that automatically

borkdude15:03:55

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?

johan1a15:03:22

I added it here

borkdude15:03:22

@johan1a I mean the output of your failing compilation.

borkdude15:03:03

ok, weird, I don't see anything suspicious about cljfmt there. thanks for sharing

👍 1
ericdallo15:03:09

I already saw 1 or 2 projects following that rule

borkdude15:03:56

Nice, yeah, I knew that it existed, but haven't used it.

ericdallo15:03:59

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

lread16:03:23

huh… looks like current GraalVM install instruction https://www.graalvm.org/docs/getting-started/linux/.

lread17:03:56

merci buckets!

borkdude17:03:18

I also saw they used this in some of their latest streaming videos on twitch. But regardless, I think it's a saner convention

borkdude17:03:44

since GraalVM has more stuff than only invoking native-image, like the gu installer for installing native-image in the first place

lread17:03:18

I use SDKman and it only sets JAVA_HOME, but I’ll stick with GRAALVM_HOME for clj-graal-docs hello world.

borkdude17:03:19

and it's easier to set JAVA_HOME to GRAALVM_HOME and place GRAALVM_HOME/bin on the path

lread18:03:39

I end up setting GRAALVM_HOME to JAVA_HOME for scripts that require it. But either way is good with me.

ericdallo17:03:37

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

lread18:03:41

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

borkdude18:03:36

Haha! thanks!