scalameta / sbt-native-image

Plugin to generate native-image binaries with sbt
248 stars 22 forks source link

Unable to get graalvm in index on macm1 #49

Open masonedmison opened 2 years ago

masonedmison commented 2 years ago

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.

  1. Run command 'sbt myproject/nativeImage'

Expected behavior

I would expect the binary to be generated

Installation:

Additional context

I can see a graalvm-java11 entry "...github.com/coursier/jvm-index/.../index.json" entry.

Search terms

m1 java11

olafurpg commented 2 years ago

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.

masonedmison commented 2 years ago

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?