scalameta / sbt-native-image

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

Scala 3, Windows 10 failing to produce a native image, Error: Native-image building on Windows currently only supports target architecture: AMD64 (x86 unsupported) #19

Closed PhilAndrew closed 3 years ago

PhilAndrew commented 3 years ago

Github project https://github.com/PhilAndrew/dotty-project-template

Error: Native-image building on Windows currently only supports target architecture: AMD64 (x86 unsupported)

Running within C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2019\Visual Studio Tools Developer Command Prompt for VS 2019

C:\home\projects\r\dotty-project-template>sbt nativeImage [info] welcome to sbt 1.4.2 (Oracle Corporation Java 11.0.2) [info] loading global plugins from C:\Users\philip.sbt\1.0\plugins [info] loading settings for project dotty-project-template-build-build-build from metals.sbt ... [info] loading project definition from C:\home\projects\r\dotty-project-template\project\project\project [info] loading settings for project dotty-project-template-build-build from metals.sbt ... [info] loading project definition from C:\home\projects\r\dotty-project-template\project\project [success] Generated .bloop\dotty-project-template-build-build.json [success] Total time: 1 s, completed 3 Dec. 2020, 7:52:58 pm [info] loading settings for project dotty-project-template-build from metals.sbt,plugins.sbt ... [info] loading project definition from C:\home\projects\r\dotty-project-template\project [success] Generated .bloop\dotty-project-template-build.json [success] Total time: 1 s, completed 3 Dec. 2020, 7:52:59 pm [info] loading settings for project root from build.sbt ... [info] set current project to dotty-simple (in build file:/C:/home/projects/r/dotty-project-template/) [info] C:\Users\philip\AppData\Local\Coursier\cache\jvm\graalvm-java11@20.2.0\bin\native-image.cmd -cp C:\home\projects\r\dotty-project-template\target\scala-3.0.0-M2\classes;C:\Users\philip\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\org\scalameta\svm-subs\101.0.0\svm-subs-101.0.0.jar;C:\Users\philip\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\org\scala-lang\scala3-library_3.0.0-M2\3.0.0-M2\scala3-library_3.0.0-M2-3.0.0-M2.jar;C:\Users\philip\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\org\scala-lang\scala-library\2.13.4\scala-library-2.13.4.jar Main C:\home\projects\r\dotty-project-template\target\native-image\dotty-simple [C:\home\projects\r\dotty-project-template\target\native-image\dotty-simple:68156] classlist: 3,387.06 ms, 0.96 GB [C:\home\projects\r\dotty-project-template\target\native-image\dotty-simple:68156] setup: 775.27 ms, 0.96 GB Error: Native-image building on Windows currently only supports target architecture: AMD64 (x86 unsupported) Error: To prevent native-toolchain checking provide command-line option -H:-CheckToolchain Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception Error: Image build request failed with exit status 1 [info] Native image ready! [info] C:\home\projects\r\dotty-project-template\target\native-image\dotty-simple [success] Total time: 9 s, completed 3 Dec. 2020, 7:53:11 pm

C:\home\projects\r\dotty-project-template>sbt nativeImage

olafurpg commented 3 years ago

Thank you for reporting! This error appears to come from native-image itself. Have you verified that you can generate a native-image manually? If it works, what JVM do you use? This plugin uses Coursier to install GraalVM so there's isn't much we can do on this side to fix this issue

PhilAndrew commented 3 years ago

I don't know how to generate a native image manually.

Apart from that - can you tell me what environment and steps work for building native image within windows 10 so I can try to reproduce a working build?

For me I have:

sbt version [info] welcome to sbt 1.5.0-RC2 (GraalVM Community Java 11.0.10)

java -version openjdk version "11.0.10" 2021-01-19 OpenJDK Runtime Environment GraalVM CE 21.0.0 (build 11.0.10+8-jvmci-21.0-b06) OpenJDK 64-Bit Server VM GraalVM CE 21.0.0 (build 11.0.10+8-jvmci-21.0-b06, mixed mode, sharing)

I ran this within "x86 Native Tools Command Prompt for VS 2019"

PhilAndrew commented 3 years ago

Ah I worked it out, I need to run from "x64 Native Tools Command prompt for VS 2019", NOT "x86 Native Tools Command prompt for VS 2019".

Now it works. Ok very happy now.