sbt-native-image
sbt-native-image copied to clipboard
Unable to get graalvm in index on macm1
Describe the bug
Unable to find graalvm in index when running nativeImage
command.
To Reproduce Steps to reproduce the behavior: with additional setting of:
JVM graalvm-java11:21.0.0 not found in index: JVM graalvm-java11 not found
and run sbt myproject/nativeImage
.
- Run command 'sbt myproject/nativeImage'
Expected behavior
I would expect the binary to be generated
Installation:
- Operating system: macOS/Linux - mac m1
- Version: Monterey 12.2.1
Additional context
I can see a graalvm-java11
entry "...github.com/coursier/jvm-index/.../index.json" entry.
Search terms
m1 java11
Thank you for reporting! The Java installation is discovered through the coursier java-home
command, as implemented here
https://github.com/scalameta/sbt-native-image/blob/9cee2c1d066d7d737cd4081164622b2fd27d9f3f/plugin/src/main/scala/sbtnativeimage/NativeImagePlugin.scala#L168-L173
The version 21.0.0 does not support M1, it seems like you need to use a devbuild instead https://github.com/oracle/graal/issues/2666
There's not much sbt-native-image can do to fix this issue except to upgrade the default GraalVM version when the latest stable release supports M1.
Thanks so much for the kind reply! I'll try to get the devbuild installed tonight and give it another go. In theory, I should be able to pass the path to this devbuild with nativeImageGraavlHome
and that will override the automatic fetching via coursier
, yeah?