Quarkus: Native container-build on Windows10 fails (.exe)

Created on 19 Mar 2020  路  5Comments  路  Source: quarkusio/quarkus

Describe the bug
Building a native image inside docker causes an error.
It seems the build is looking for a .exe file. But with containerized build inside docker no .exe file is generated - and that is okay :-)

Expected behavior
Linux executable generated.

Actual behavior

[INFO] --- quarkus-maven-plugin:1.3.0.Final:build (default) @ example ---
[INFO] [org.jboss.threads] JBoss Threads version 3.0.1.Final
[INFO] [org.hibernate.Version] HHH000412: Hibernate ORM core version 5.4.12.Final
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: C:\git\CA.micro\example-quarkus\example\target\example-1.0.0-SNAPSHOT-native-image-source-jar\example-1.0.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from C:\git\CA.micro\example-quarkus\example\target\example-1.0.0-SNAPSHOT-native-image-source-jar\example-1.0.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Pulling image quay.io/quarkus/ubi-quarkus-native-image:20.0.0-java11
20.0.0-java11: Pulling from quarkus/ubi-quarkus-native-image
57de4da701b5: Pull complete
cf0f3ebe9f53: Pull complete
bc826280acdc: Pull complete
Digest: sha256:7716147f3621829b8039dec6c2c56ec9eaea705e5d1b83899c600cc575c3a1a2
Status: Downloaded newer image for quay.io/quarkus/ubi-quarkus-native-image:20.0.0-java11
quay.io/quarkus/ubi-quarkus-native-image:20.0.0-java11
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 20.0.0 CE
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] docker run -v //c/git/CA.micro/example-quarkus/example/target/example-1.0.0-SNAPSHOT-native-image-source-jar:/project:z --env LANG=C --rm quay.io/quarkus/ubi-quarkus-native-image:20.0.0-java11 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Dsun.nio.ch.maxUpdateArraySize=100 -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 -J-Duser.language=de -J-Dfile.encoding=Cp1252 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -H:+JNI -jar example-1.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -J-Xmx8g -H:-AddAllCharsets -H:-IncludeAllTimeZones -H:EnableURLProtocols=http,https --enable-all-security-services -H:-UseServiceLoaderFeature -H:+StackTrace example-1.0.0-SNAPSHOT-runner
Build on Server(pid: 28, port: 43973)*
[example-1.0.0-SNAPSHOT-runner:28]    classlist:  33.900,33 ms,  1,00 GB
[example-1.0.0-SNAPSHOT-runner:28]        (cap):     946,80 ms,  1,00 GB
[example-1.0.0-SNAPSHOT-runner:28]        setup:   3.569,52 ms,  1,00 GB
15:50:57,711 INFO  [org.hib.Version] HHH000412: Hibernate ORM core version 5.4.12.Final
15:50:57,742 INFO  [org.hib.ann.com.Version] HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
15:50:57,846 INFO  [org.hib.dia.Dialect] HHH000400: Using dialect: io.quarkus.hibernate.orm.runtime.dialect.QuarkusPostgreSQL10Dialect
15:51:00,713 INFO  [org.jbo.threads] JBoss Threads version 3.0.1.Final
[example-1.0.0-SNAPSHOT-runner:28]   (typeflow): 141.095,72 ms,  3,10 GB
[example-1.0.0-SNAPSHOT-runner:28]    (objects):  66.946,90 ms,  3,10 GB
[example-1.0.0-SNAPSHOT-runner:28]   (features):   3.858,65 ms,  3,10 GB
[example-1.0.0-SNAPSHOT-runner:28]     analysis: 219.111,09 ms,  3,10 GB
[example-1.0.0-SNAPSHOT-runner:28]     (clinit):   2.007,05 ms,  3,10 GB
[example-1.0.0-SNAPSHOT-runner:28]     universe:   8.045,85 ms,  3,10 GB
[example-1.0.0-SNAPSHOT-runner:28]      (parse):  14.765,83 ms,  2,36 GB
[example-1.0.0-SNAPSHOT-runner:28]     (inline):  13.104,63 ms,  2,73 GB
[example-1.0.0-SNAPSHOT-runner:28]    (compile): 105.498,51 ms,  2,80 GB
[example-1.0.0-SNAPSHOT-runner:28]      compile: 140.530,07 ms,  2,80 GB
[example-1.0.0-SNAPSHOT-runner:28]        image:   9.756,83 ms,  2,80 GB
[example-1.0.0-SNAPSHOT-runner:28]        write:   4.205,53 ms,  2,80 GB
[example-1.0.0-SNAPSHOT-runner:28]      [total]: 420.428,43 ms,  2,80 GB
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  17:00 min
[INFO] Finished at: 2020-03-19T16:57:19+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.3.0.Final:build (default) on project example: Failed to build quarkus application: io.quarkus.builder.BuildException: 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:352)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[ERROR]         at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:938)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:273)
[ERROR]         at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2027)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1551)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1442)
[ERROR]         at java.base/java.lang.Thread.run(Thread.java:834)
[ERROR]         at org.jboss.threads.JBossThread.run(JBossThread.java:479)
[ERROR] Caused by: java.nio.file.NoSuchFileException: C:\git\CA.micro\example-quarkus\example\target\example-1.0.0-SNAPSHOT-native-image-source-jar\example-1.0.0-SNAPSHOT-runner.exe
[ERROR]         at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
[ERROR]         at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
[ERROR]         at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
[ERROR]         at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:53)
[ERROR]         at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:38)
[ERROR]         at java.base/sun.nio.fs.WindowsFileSystemProvider.readAttributes(WindowsFileSystemProvider.java:198)
[ERROR]         at java.base/java.nio.file.Files.readAttributes(Files.java:1763)
[ERROR]         at java.base/java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:225)
[ERROR]         at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
[ERROR]         at java.base/java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322)
[ERROR]         at java.base/java.nio.file.Files.walkFileTree(Files.java:2716)
[ERROR]         at io.quarkus.bootstrap.util.IoUtils.copy(IoUtils.java:98)
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:346)
[ERROR]         ... 12 more
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

To Reproduce
Steps to reproduce the behavior:

  1. Start the build mvn clean package -Pnative

Configuration
quarkus.native.container-build=true quarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-native-image:20.0.0-java11

Environment

  • Output of uname -a or ver: Microsoft Windows [Version 10.0.17134.1304]
  • Output of java -version:
openjdk version "11.0.6" 2020-01-14 LTS
OpenJDK Runtime Environment Zulu11.37+17-CA (build 11.0.6+10-LTS)
OpenJDK 64-Bit Server VM Zulu11.37+17-CA (build 11.0.6+10-LTS, mixed mode)
  • GraalVM version (if different from Java): 20.0.0-java11
  • Quarkus version or git rev: 1.3.0.Final
  • Build tool (ie. output of mvnw --version or gradlew --version):
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\devtools\apache-maven-3.6.3\bin\..
Java version: 11.0.6, vendor: Azul Systems, Inc., runtime: C:\Program Files\Zulu\zulu-11
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
enwindows kinbug

All 5 comments

In contrast using Quarkus 1.2.1.Final with GraalVM 19.3.1-java11 works correct.

Perhaps this might help https://github.com/quarkusio/quarkus/pull/8010. I don't have a Windows OS at hand to test this out.

The code looks promising. I will test it on my windows machine and give feedback as soon the build has finished.

The test with the code-change of the pull-request on my windows machine succeeded.
It would be great to see this fix in release 1.3.1

Yup. I already marked it for backport :).

Was this page helpful?
0 / 5 - 0 ratings