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...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
Well there is that
Reflection warning, zprint/zprint.cljc:8181:27 - reference to field toString can't be resolved.
line above...Also kind of weird that warn-on-boxed is enabled. I only set *warn-on-reflection* (in project.clj)
Perhaps warn-on-boxed is set inside of the project itself. The toString thing can be fixed in zprint
but if you add a reflection config for Object you can likely just work around it
better to fix it inside of zprint though
@lee told me the zprint author doesn't hang out here. I'll file an issue.
just replacing the interop by (str ..) will fix the issue
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
This version number is probably too old.best to check what is used in CI in GitHub Actions
Ok thanks, I'll take a look there
Any recent GraalVM version should work, I bumped CI to Oracle GraalVM 21 now
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.
I think it was to force people to use the newest version back then but the text was never updated
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.I'm not 100% sure what you mean but maybe just submit a PR and then I'll understand :)
Fair enough, I'll submit a PR and hopefully I'll explain better there :)
fyi - https://github.com/babashka/sci/pull/908 here's the PR I hope I did a better job of explaining there
@emailudeshx I think we have a misunderstanding. You can just run bb libsci:compile to compile the native binary
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.I see, I missed that part of the instructions somehow. Well that makes my PR redundant. Sorry for the confusion.
No worries