Fork me on GitHub
#graalvm
<
2023-10-07
>
Udesh05:10:53

Hi, I'm following the instructions for Libsci https://github.com/babashka/sci/blob/master/doc/libsci.md "Currently 20.3.0 Java 11 must be used." The instructions state that 20.3.0 is the GraalVM version to install, I'm using a M1 ARM and there doesn't appear to be a ARM download available for this version of GraalVM Am I understanding the instructions correctly? If so is there any solution for me using 20.3.0 with an M1. The link below says there is a solution using Rosetta 2, is that what I should look at doing? https://github.com/oracle/graal/issues/2666 Thanks

borkdude07:10:51

This version number is probably too old.best to check what is used in CI in GitHub Actions

👍 1
Udesh09:10:29

Ok thanks, I'll take a look there

borkdude09:10:48

Any recent GraalVM version should work, I bumped CI to Oracle GraalVM 21 now

Udesh09:10:24

I see, then i'll use a recent version. Just thought there might be a reason for saying 20.3.0 exactly in the instructions. Thanks for the help.

borkdude09:10:14

I think it was to force people to use the newest version back then but the text was never updated

Udesh12:10:46

Makes sense. Well fwiw I followed the rest of the instructions and got the example with from_cpp.cpp to work so I can confirm the latest GraalVM works fine for M1 Arm. There was one part of the instructions that might be useful to update/simplify. Since the compile-native fn in libsci_tasks.clj does this part of the instructions automatically now.

$GRAALVM_HOME/bin/native-image \
  -jar $SCI_JAR \
  -cp libsci/src \
  -H:Name=libsci \
  --shared \
  ...
Instead of using the command line instructions shown. I called (compile-native) at the end of a copy of libsci_tasks.clj that was moved to the root of the sci project folder. Running 'bb libsci_tasks.clj' generated all the files automatically in the right directories. If it's helpful to you I can make this small change to libsci.md and submit a PR.

borkdude12:10:17

I'm not 100% sure what you mean but maybe just submit a PR and then I'll understand :)

Udesh12:10:05

Fair enough, I'll submit a PR and hopefully I'll explain better there :)

Udesh03:10:58

fyi - https://github.com/babashka/sci/pull/908 here's the PR I hope I did a better job of explaining there

borkdude10:10:42

@U05NDSC6VPU I think we have a misunderstanding. You can just run bb libsci:compile to compile the native binary

borkdude10:10:13

The docs are already saying:

Convenient `babashka` tasks are provided to compile `libsci` and most
of the examples mentioned here, see `bb tasks` for the full list.

Udesh12:10:18

I see, I missed that part of the instructions somehow. Well that makes my PR redundant. Sorry for the confusion.

borkdude13:10:56

No worries

👍 1
Ingy döt Net14:10:51

Not sure where to ask about this but I started using zprint for the yamlscript compiler to nicely format clojure code. When I run lein test it gives me a ton of warnings with *warn-on-reflection*

Auto-boxing loop arg: column
zprint.cljc:5687 recur arg for primitive local: index is not matching primitive, had: Object, needed: long
Auto-boxing loop arg: index
zprint.cljc:7753 recur arg for primitive local: newline_count is not matching primitive, had: Object, needed: long 
Auto-boxing loop arg: newline-count
Reflection warning, zprint/zprint.cljc:8181:27 - reference to field toString can't be resolved. 
Asking here as I've been told that reflections are bad for graalvm native-image...

borkdude14:10:49

Boxing doesn’t hurt GraalVM native image. The warnings you’re seeing here are because of warn-on-boxed. Only important if you want better perf, not important for getting it to work

Ingy döt Net15:10:27

Well there is that

Reflection warning, zprint/zprint.cljc:8181:27 - reference to field toString can't be resolved.
line above...

Ingy döt Net15:10:30

Also kind of weird that warn-on-boxed is enabled. I only set *warn-on-reflection* (in project.clj)

borkdude16:10:02

Perhaps warn-on-boxed is set inside of the project itself. The toString thing can be fixed in zprint

borkdude16:10:11

but if you add a reflection config for Object you can likely just work around it

borkdude16:10:23

better to fix it inside of zprint though

Ingy döt Net16:10:24

@UE21H2HHD told me the zprint author doesn't hang out here. I'll file an issue.

borkdude16:10:40

just replacing the interop by (str ..) will fix the issue