Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nativeImage on Windows fails in 0.3.1 and 0.3.2 (No issue in 0.3.0) #53

Open
kevin-lee opened this issue Jun 15, 2022 · 3 comments
Open

Comments

@kevin-lee
Copy link

kevin-lee commented Jun 15, 2022

Describe the bug
nativeImage on Windows fails in sbt-native-image 0.3.1 and 0.3.2 (No issue in 0.3.0).

I'm getting the following error when running nativeImage on Windows platform in GitHub Actions.
https://github.com/Kevin-Lee/whatsub/runs/6899749209?check_suite_focus=true#step:7:304

========================================================================================================================
GraalVM Native Image: Generating 'D:\a\whatsub\whatsub\cli\target\native-image\whatsub-cli' (executable)...
========================================================================================================================
[1/7] Initializing...                                                                                    (0.0s @ 0.10GB)
Fatal error: java.lang.NoClassDefFoundError: pirate/Command
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402)
	at java.base/java.lang.Class.getDeclaredMethod(Class.java:2673)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:359)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:585)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:615)
Caused by: java.lang.ClassNotFoundException: pirate.Command
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
	... 7 more
Error: Image build request failed with exit status 1
com.oracle.svm.driver.NativeImage$NativeImageError: Image build request failed with exit status 1
	at com.oracle.svm.driver.NativeImage.showError(NativeImage.java:1678)
	at com.oracle.svm.driver.NativeImage.build(NativeImage.java:1389)
	at com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1350)
	at com.oracle.svm.driver.NativeImage.main(NativeImage.java:1337)
[error] native-image command failed with exit code '1'
[error] (cli / nativeImage) native-image command failed with exit code '1'
[error] Total time: 30 s, completed Jun 15, 2022, 12:37:27 PM

I get no error and build is successfully done if I use 0.3.0.

To Reproduce Steps to reproduce the behavior:

  1. Run command nativeImage
  2. Watch the build log please.

Expected behavior

Successful build like this one: https://github.com/Kevin-Lee/whatsub/runs/6900296176?check_suite_focus=true#step:7:306
It's the build result when sbt-native-image 0.3.0 is used.

Screenshots

Failed build when 0.3.1 or 0.3.2 is used. (This screenshot was taken from the build with 0.3.2).
Screen Shot 2022-06-15 at 11 19 15 pm

Installation:

  • Operating system: Windows
  • Version: windows-latest from GitHub Actions

Additional Info
The command executed by GitHub Actions:

Executing [
'C:\Users\runneradmin\AppData\Local\Coursier\cache\jvm\graalvm-java17@22.1.0\bin\java.exe' \
-XX:+UseParallelGC \
-XX:+UnlockExperimentalVMOptions \
-XX:+EnableJVMCI \
-Dtruffle.TrustAllTruffleRuntimeProviders=true \
-Dtruffle.TruffleRuntime=com.oracle.truffle.api.impl.DefaultTruffleRuntime \
-Dgraalvm.ForcePolyglotInvalid=true \
-Dgraalvm.locatorDisabled=true \
-Dsubstratevm.IgnoreGraalVersionCheck=true \
--add-exports=java.base/com.sun.crypto.provider=ALL-UNNAMED \
--add-exports=java.base/jdk.internal.access.foreign=ALL-UNNAMED \
--add-exports=java.base/jdk.internal.event=ALL-UNNAMED \
--add-exports=java.base/jdk.internal.loader=ALL-UNNAMED \
--add-exports=java.base/jdk.internal.logger=ALL-UNNAMED \
--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED \
--add-exports=java.base/jdk.internal.module=ALL-UNNAMED \
--add-exports=java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
--add-exports=java.base/jdk.internal.perf=ALL-UNNAMED \
--add-exports=java.base/jdk.internal.platform=ALL-UNNAMED \
--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED \
--add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED \
--add-exports=java.base/jdk.internal.vm.annotation=ALL-UNNAMED \
--add-exports=java.base/sun.invoke.util=ALL-UNNAMED \
--add-exports=java.base/sun.net=ALL-UNNAMED \
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED \
--add-exports=java.base/sun.reflect.annotation=ALL-UNNAMED \
--add-exports=java.base/sun.reflect.generics.factory=ALL-UNNAMED \
--add-exports=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED \
--add-exports=java.base/sun.reflect.generics.repository=ALL-UNNAMED \
--add-exports=java.base/sun.reflect.generics.scope=ALL-UNNAMED \
--add-exports=java.base/sun.reflect.generics.tree=ALL-UNNAMED \
--add-exports=java.base/sun.security.jca=ALL-UNNAMED \
--add-exports=java.base/sun.security.provider=ALL-UNNAMED \
--add-exports=java.base/sun.security.ssl=ALL-UNNAMED \
--add-exports=java.base/sun.security.util=ALL-UNNAMED \
--add-exports=java.base/sun.security.x509=ALL-UNNAMED \
--add-exports=java.base/sun.text.spi=ALL-UNNAMED \
--add-exports=java.base/sun.util.calendar=ALL-UNNAMED \
--add-exports=java.base/sun.util.cldr=ALL-UNNAMED \
--add-exports=java.base/sun.util.locale.provider=ALL-UNNAMED \
--add-exports=java.base/sun.util.locale=ALL-UNNAMED \
--add-exports=java.base/sun.util.resources=ALL-UNNAMED \
--add-exports=java.base/sun.util=ALL-UNNAMED \
--add-exports=java.desktop/sun.java2d.pipe=ALL-UNNAMED \
--add-exports=java.desktop/sun.java2d=ALL-UNNAMED \
--add-exports=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED \
--add-exports=java.management/sun.management=ALL-UNNAMED \
--add-exports=java.xml.crypto/org.jcp.xml.dsig.internal.dom=ALL-UNNAMED \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.aarch64=ALL-UNNAMED \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.amd64=ALL-UNNAMED \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.code.site=ALL-UNNAMED \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.code.stack=ALL-UNNAMED \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.code=ALL-UNNAMED \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.common=ALL-UNNAMED \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.hotspot.aarch64=ALL-UNNAMED \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.hotspot.amd64=ALL-UNNAMED \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.hotspot=ALL-UNNAMED \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.meta=ALL-UNNAMED \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.runtime=ALL-UNNAMED \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.services=ALL-UNNAMED \
--add-exports=jdk.jfr/jdk.jfr.events=ALL-UNNAMED \
--add-exports=jdk.jfr/jdk.jfr.internal.handlers=ALL-UNNAMED \
--add-exports=jdk.jfr/jdk.jfr.internal.jfc=ALL-UNNAMED \
--add-exports=jdk.jfr/jdk.jfr.internal=ALL-UNNAMED \
--add-exports=jdk.management/com.sun.management.internal=ALL-UNNAMED \
-XX:+UseJVMCINativeLibrary \
-Xss10m \
-Xms1g \
-Xmx601[257](https://github.com/Kevin-Lee/whatsub/runs/6899749209?check_suite_focus=true#step:7:258)7376 \
-Djava.awt.headless=true \
-Dorg.graalvm.version=22.1.0 \
-Dorg.graalvm.config=CE \
-Dcom.oracle.graalvm.isaot=true \
-Djava.system.class.loader=com.oracle.svm.hosted.NativeImageSystemClassLoader \
-Xshare:off \
-Djdk.internal.lambda.disableEagerInitialization=true \
-Djdk.internal.lambda.eagerlyInitialize=false \
-Djava.lang.invoke.InnerClassLambdaMetafactory.initializeLambdas=false \
'-javaagent:C:\Users\runneradmin\AppData\Local\Coursier\cache\jvm\graalvm-java17@22.1.0\lib\svm\builder\svm.jar' \
-cp \
'C:\Users\runneradmin\AppData\Local\Coursier\cache\jvm\graalvm-java17@22.1.0\lib\svm\builder\native-image-base.jar;C:\Users\runneradmin\AppData\Local\Coursier\cache\jvm\graalvm-java17@22.1.0\lib\svm\builder\objectfile.jar;C:\Users\runneradmin\AppData\Local\Coursier\cache\jvm\graalvm-java17@22.1.0\lib\svm\builder\pointsto.jar;C:\Users\runneradmin\AppData\Local\Coursier\cache\jvm\graalvm-java17@22.1.0\lib\svm\builder\svm.jar' \
--module-path \
'C:\Users\runneradmin\AppData\Local\Coursier\cache\jvm\graalvm-java17@22.1.0\lib\truffle\truffle-api.jar' \
'com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus' \
-imagecp \
'D:\a\whatsub\whatsub\cli\target\native-image-internal\manifest.jar;D:\a\whatsub\whatsub\cli\target\scala-3.1.2\classes;D:\a\whatsub\whatsub\core\target\scala-3.1.2\classes;D:\a\whatsub\whatsub\cli\target\native-image-internal\classes;D:\a\whatsub\whatsub\cli\target\native-image-internal\scala3-library_3-3.1.2.jar;D:\a\whatsub\whatsub\cli\target\native-image-internal\svm-subs-101.0.0.jar;D:\a\whatsub\whatsub\cli\target\native-image-internal\cats-core_3-2.7.0.jar;D:\a\whatsub\whatsub\cli\target\native-image-internal\cats-effect_3-3.3.6.jar;D:\a\whatsub\whatsub\cli\target\native-image-internal\cats-parse_3-0.3.4.jar;D:\a\whatsub\whatsub\cli\target\native-image-internal\effectie-cats-effect3_3-2.0.0-SNAPSHOT.jar;D:\a\whatsub\whatsub\cli\target\native-image-internal\extras-cats_3-0.4.0.jar;D:\a\whatsub\whatsub\cli\target\native-image-internal\extras-scala-io_3-0.4.0.jar;D:\a\whatsub\whatsub\cli\target\native-image-internal\scalaz-core_2.13-7.2.31.jar;D:\a\whatsub\whatsub\cli\target\native-image-internal\scalaz-effect_2.13-7.2.31.jar;D:\a\whatsub\whatsub\cli\target\native-image-internal\scala-library-2.13.8.jar;D:\a\whatsub\whatsub\cli\target\native-image-internal\cats-kernel_3-2.7.0.jar;D:\a\whatsub\whatsub\cli\target\native-image-internal\simulacrum-scalafix-annotations_3-0.5.4.jar;D:\a\whatsub\whatsub\cli\target\native-image-internal\cats-effect-kernel_3-3.3.6.jar;D:\a\whatsub\whatsub\cli\target\native-image-internal\cats-effect-std_3-3.3.6.jar;D:\a\whatsub\whatsub\cli\target\native-image-internal\effectie-core_3-2.0.0-SNAPSHOT.jar;D:\a\whatsub\whatsub\cli\target\native-image-internal\effectie-cats_3-2.0.0-SNAPSHOT.jar;D:\a\whatsub\whatsub\cli\target\native-image-internal\slf4j-api-1.7.32.jar;C:\Users\runneradmin\AppData\Local\Coursier\cache\jvm\graalvm-java17@22.1.0\lib\svm\library-support.jar' \
'-H:Path=D:\a\whatsub\whatsub\cli\target\native-image' \
'-H:DynamicProxyConfigurationResources@jar:file:///D:/a/whatsub/whatsub/cli/target/native-image-internal/cats-effect_3-3.3.6.jar!/META-INF/native-image/org.typelevel/cats-effect/native-image.properties=META-INF/native-image/org.typelevel/cats-effect/sun-misc-signal-proxy-config.json' \
-H:FallbackThreshold=0 \
-H:+ReportExceptionStackTraces \
-H:ClassInitialization=:build_time \
-H:+AddAllCharsets \
-H:+ReportUnsupportedElementsAtRuntime \
'-H:CLibraryPath=C:\Users\runneradmin\AppData\Local\Coursier\cache\jvm\graalvm-java17@22.1.0\lib\svm\clibraries\windows-amd64' \
'-H:Class@explicit main-class=whatsub.WhatsubApp' \
'-H:Name@explicit image name=D:\a\whatsub\whatsub\cli\target\native-image\whatsub-cli'
]
@eed3si9n
Copy link
Contributor

I had to figure out how to build on Windows yesterday for sbt release. I don't think I saw the error message you're seeing but for me what fixed for me was downgrading to windows-2019 image. See https://github.com/sbt/sbtn-dist/blob/1c92452932ec5a3693e242dc6136ed6c3fed75c7/.github/workflows/native.yml for the current YAML.

Also sent #54 as fix.

@kevin-lee
Copy link
Author

@eed3si9n Thanks Eugene. Sorry I found your answer only today.
Unfortunately, downgrading to windows-2019 doesn't solve my issue.
With these changes, the result is still the same.

@2m
Copy link

2m commented Sep 3, 2022

The path to vcvars64.bat changed a bit in Windows 2022:

-        "C:\Program Files (x86)\Microsoft Visual
-        Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" && sbt
+        "C:\Program Files\Microsoft Visual
+        Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" && sbt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants