Describe the bug
I am running on a Win10 laptop, and tried to build a native image using GraalVM CE 19.2.1 after creating a basic project from https://code.quarkus.io/ (version 1.0.0.RC1) and I get an "augmentation" error.
I tried from the Windows command line and from a Git Bash, both result in the same error.
Expected behavior
Well, getting a native image generated ;)
Actual behavior
[INFO] --- quarkus-maven-plugin:1.0.0.CR1:build (default) @ code-with-quarkus ---
[INFO] [io.quarkus.deployment.QuarkusAugmentor] Beginning quarkus augmentation
[INFO] [org.jboss.threads] JBoss Threads version 3.0.0.Final
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: C:\Users\vleon\code-with-quarkus\target\code-with-quarkus-1.0.0-SNAPSHOT-native-image-source-jar\code-with-quarkus-1.0.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from C:\Users\vleon\code-with-quarkus\target\code-with-quarkus-1.0.0-SNAPSHOT-native-image-source-jar\code-with-quarkus-1.0.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on OpenJDK 64-Bit GraalVM CE 19.2.1
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] C:\Users\vleon\graalvm-ce-19.2.1\bin\native-image.cmd -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar code-with-quarkus-1.0.0-SNAPSHOT-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http -H:-JNI -H:-UseServiceLoaderFeature -H:+StackTrace code-with-quarkus-1.0.0-SNAPSHOT-runner
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.364 s
[INFO] Finished at: 2019-11-13T21:09:52+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.0.0.CR1:build (default) on project code-with-quarkus: Failed to build a runnable JAR: Failed to augment application classes: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Failed to build native image
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:294)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR] at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:941)
[ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
[ERROR] at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
[ERROR] at java.lang.Thread.run(Thread.java:748)
[ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:479)
[ERROR] Caused by: java.lang.RuntimeException: Image generation failed
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:283)
[ERROR] ... 12 more
To Reproduce
Steps to reproduce the behavior:
GRAALVM_HOME and JAVA_HOME env variables, update PATH with the updated JAVA_HOME\binmvnw package -PnativeEnvironment (please complete the following information):
Additional context
Setting env variables this way:
set GRAALVM_HOME=<PATH TO>\graalvm-ce-19.2.1
set JAVA_HOME=<PATH TO>\graalvm-ce-19.2.1
set PATH=%JAVA_HOME%\bin;%PATH%
Attached the full Maven log (with -e option).
build_native.txt
Issue moved from code.quarkus.io to quarkus
Can you please check if C:\Users\vleon\Downloads\quarkus-coding-dojo\graalvm-ce-19.2.1\bin\native-image.cmd is valid executable?
Can you please check if
C:\Users\vleon\Downloads\quarkus-coding-dojo\graalvm-ce-19.2.1\bin\native-image.cmdis valid executable?
It seems to be:
C:\Users\vleon\graalvm-ce-19.2.1\bin>native-image.cmd
Please specify options for native-image building or use --help for more info.
C:\Users\vleon\graalvm-ce-19.2.1\bin>native-image.cmd --help
GraalVM native-image building tool
This tool can be used to generate an image that contains ahead-of-time compiled Java code.
[...]
Looks good indeed.
Could you also try and run the native-image command printed in the output manually and see what you get?
Looks good indeed.
Could you also try and run the native-image command printed in the output manually and see what you get?
Surprisingly it worked :O
I got the runner jar generated and was able to execute it !
I didn't expect that to be honest...
And unfortunately I don't have a Windows machine to test and reproduce this. I am sure that someone with such a machine will give it a go soon 馃槈
Actually, I'm not so sure it worked as expected...
The native command does not throw any error, still I cannot find the runner file.
I thought yesterday that it worked, but actually I realize that whatI saw (the runner.jar file) is there because of the JarResultBuildStep that is processed before the NativeImageBuildStep
I get a Segmentation fault error when running the native-image.cmd.
That sounds like a GraalVM bug
I get a
Segmentation faulterror when running thenative-image.cmd.
It's strange that I did not get any error returned on my side, did you do something special to see the error?
That sounds like a GraalVM bug
I would tend to say that it's the case indeed...
I only copy and pasted the command that was shown.
Interestingly, this crash occurs only when -J-Dio.netty.allocator.maxOrder=1 is passed to the native image command. Quarkus sets it by default, so right now that can't be skipped. Plus, I don't yet know why setting that param would result in a crash.
I created https://github.com/oracle/graal/issues/1843 to have it tracked in Graal
I created oracle/graal#1843 to have it tracked in Graal
Thank you!
@gsmet This issue can be closed. It is no longer a problem on Windows.
Thanks for checking @Karm.
I'll close it