graalvm

Discuss GraalVM related topics. Use clojure 1.10.2 or newer for all new projects. Contribute to https://github.com/clj-easy/graal-docs and https://github.com/BrunoBonacci/graalvm-clojure. GraalVM slack: https://www.graalvm.org/slack-invitation/.
ericdallo 2021-01-28T14:00:15.044900Z

Ok, so the type hinting fixed that case, but It being really hard to make lsp4j work correctly, it looks it uses a lot of reflection and I'm not sure I'm on the right path... The https://github.com/clojure-lsp/clojure-lsp/pull/267/files#diff-736ec9c37d3ba754db0a1f0c6cc5df40e8f284fb11e4824e55920cce814c37d8R1 already looks huge and I started to think that adding some classes have caused inconsistency like request params objects come with some fields null and etc. Also I could not run the java from graalvm to check what should looks like my reflection.json since is not available for my NixOS 😕

Shantanu Kumar 2021-01-28T15:40:03.045100Z

@ericdallo If you add this to your project.clj, you might get all the reflection warnings with lein before even trying GraalVM:

:global-vars {*warn-on-reflection* true
                *assert* true
                *unchecked-math* :warn-on-boxed}

borkdude 2021-01-28T15:41:06.045300Z

this won't help for java code which uses reflection

1✔️
borkdude 2021-01-28T15:41:24.045500Z

for this you can use the graalvm agent

ericdallo 2021-01-28T15:44:06.046100Z

Yep, that's the agent that should be used with graal's java that is not available for NixOs :/

borkdude 2021-01-28T15:44:46.046300Z

you can just download graalvm to a Downloads directory. there is no need to "install". Or aren't you allowed to downloading anything in nixOS?

ericdallo 2021-01-28T15:47:54.046500Z

I can if it don't use any other lib

ericdallo 2021-01-28T15:48:06.046700Z

I will give a try so

borkdude 2021-01-28T15:51:16.046900Z

yes, it's standalone. just unzip it and set GRAALVM_HOME to the thing and then use $GRAALVM_HOME/native-image

borkdude 2021-01-28T15:51:42.047100Z

this is how I use multiple graalvm versions side by side

borkdude 2021-01-28T15:53:21.047300Z

also run $GRAALVM_HOME/gu install native-image

borkdude 2021-01-28T15:54:04.047500Z

$GRAALVM_HOME/bin/gu install native-image
to be precise

ericdallo 2021-01-28T16:12:06.047700Z

thanks! but to run with graal's java it should be something like $GRAALVM_HOME/bin/java I guess

borkdude 2021-01-28T16:12:57.047900Z

that's right. you can export GRAALVM_HOME on the path like export PATH="$GRAALVM_HOME/bin:$PATH"

borkdude 2021-01-28T16:13:09.048100Z

and then just run java

1👍
ericdallo 2021-01-28T16:30:17.048400Z

It doesn't work, it depends on libs from SO 😕

borkdude 2021-01-28T16:32:33.048800Z

This is what I install on CircleCI:

sudo apt-get -y install gcc g++ zlib1g-dev

borkdude 2021-01-28T16:32:47.049Z

I'm sure there is a nixOS incantation for this?

borkdude 2021-01-28T16:33:15.049200Z

you can always run this in a docker I guess

ericdallo 2021-01-28T23:15:51.049400Z

I tried the docker before, but failed for some reason, I gave a try again and it worked run the java from graal with the agent on NixOS via docker:tada:

ericdallo 2021-01-28T23:18:15.049600Z

I got a huge relfect json config generated with a lot of classes from clojure and some with dynamic names (using the object reference Id)

borkdude 2021-01-28T23:19:05.050Z

Yeah, there is a lot of stuff in there that you don't need. I'm not sure why it's showing up. Maybe it helps if you run with direct linking.

1👍
borkdude 2021-01-28T23:19:27.050200Z

-J-Dclojure.compiler.direct-linking=true

borkdude 2021-01-28T23:20:10.050400Z

I'm afk now

1👋