Fork me on GitHub
#graalvm
<
2021-01-30
>
tvaughan01:01:50

Not sure if anyone is interested in yet another example of how to compile a native image, but if so https://gitlab.com/tvaughan/kibit-runner#native-image. Only docker is required. For anyone looking to reproduce this without docker, Clojure 1.10.2 is required and for some reason this needs to be specified in deps.edn. A recent version of depstar is also required.

nice 4
👀 3
lread18:01:09

Just upgraded rewrite-clj v1 branch tests to use Graal v21.0.0. One more datapoint, @borkdude, for the https://github.com/borkdude/clj-reflector-graal-java11-fix not being needed!

lread18:01:46

For my Graal sci test under JDK11, I did still need to include borkdude/sci.impl.reflector. Did not dig in at all, did you expect this still to be needed @borkdude?

borkdude19:01:22

yes, this lib is needed, but already pulled in by sci itself?

ericdallo19:01:08

probably yes, since I removed from clojure-lsp and still works

lread19:01:52

Oh sorry, I meant the 0.0.1-java11 override version of borkdude/sci.impl.reflector for JDK11.

borkdude19:01:38

Right, that one isn't needed anymore, since it has the same MethodHandle code

lread19:01:29

Cool, thanks, I’ll retry without it.

lread22:01:33

If I retry my rewrite-clj sci tests without overriding borkdude/sci.impl.reflector to 0.0.1-java11, native-image compile works fine, but when I interpret my tests I get java.lang.NoSuchMethodError: java.lang.reflect.AccessibleObject.canAccess exceptions. I’ll create a todo for myself to look at this sometime later.

borkdude22:01:18

@lee I have encountered this error as well. Adding this method to the reflection config did the trick for me

lread22:01:02

Huh, I thought I had tried that! Worth another shot, thanks!

borkdude22:01:22

(or something)

borkdude22:01:42

so basically it's missed by the analysis and you have to help it a little bit

borkdude22:01:52

This might become a very common config for projects that hit this path, so probably worth documenting

borkdude22:01:31

[{"name": "java.lang.reflect.AccessibleObject",
  "methods" : [{"name":"canAccess"}]},
 ...

lread22:01:05

Ya, I’ll add a note to clj-graal-docs.

borkdude22:01:52

I think I'll copy your note to the reflector graal-fix repo then as well, since if you ran into that one, you'll probably now need this

lread22:01:53

ah, good idea!

lread22:01:20

Note that I did not need it when 1) compiling rewrite-clj and its tests, only when 2) compiling rewrite-clj for sci tests. But I don’t use a reflection.json for 1, so maybe that’s the diff.

borkdude22:01:00

yeah, sci uses this Reflector class to do interop

borkdude22:01:06

so that makes sense

lread22:01:14

Ah, right.

lread22:01:20

reflection.json fix you shared above works for rewrite-clj sci tests, thanks!

lread22:01:53

oh poo, I guess I’ll need to generate a different reflection.json for jdk8 than I do for jdk11.

borkdude22:01:28

in babashka I generate these using a script

borkdude22:01:46

different feature flags also need different reflection configs there

lread22:01:48

yeah, I stole that at one point, maybe I just need to grab an update!

lread22:01:39

ok, good stuff, should not tax my wee brain too much! simple_smile

borkdude22:01:22

there is only so much manual JSON or YAML my brain can handle before I switch to a clojure script

😂 6