quarkus: Native image build fails with unknown arguments on Windows

Describe the bug mvn package -Pnative fails with an unknown arguments error

It seems to have to do with the args being passed with -J

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on OpenJDK 64-Bit GraalVM CE 19.3.0
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] C:\Users\george\scoop\apps\graalvm\current\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 rovert-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 rovert-1.0.0-SNAPSHOT-runner
Warning: the '=' character in program arguments is not fully supported.
Make sure that command line arguments using it are wrapped in double quotes.
Example:
"--vm.Dfoo=bar"

Error: Unknown arguments: org.jboss.logmanager.LogManager, io.quarkus.vertx.core.runtime.VertxLogDelegateFactory, true, DISABLED, 1, com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime, 1, 0, http, rovert-1.0.0-SNAPSHOT-runner 

Environment (please complete the following information):

  • Output of uname -a or ver: windows 10

  • Output of java -version: openjdk version “11.0.5” 2019-10-15 OpenJDK Runtime Environment (build 11.0.5+10-jvmci-19.3-b05-LTS) OpenJDK 64-Bit GraalVM CE 19.3.0 (build 11.0.5+10-jvmci-19.3-b05-LTS, mixed mode, sharing)

  • Quarkus version or git rev: 1.0.0.RC1

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 42 (42 by maintainers)

Commits related to this issue

Most upvoted comments

I don’t recall having to run vcvars64.bat - just that you need to run the window 7 sdk terminal initially

I’m not sure what you mean by this, but without running the bat file CL won’t be found to be executed. After manually adding CL onto my path both shells complain about not having the include path set properly for the compiler. I’m assuming vcvars does something that sets an environment variable for this and only in cmd does it actually stay around after the bat file is done.

AFTER putting CL on path:

Error: Error compiling query code (in C:\Users\george\AppData\Local\Temp\SVM-5429191132714981263\AMD64LibCHelperDirectives.cpp). Compiler command  CL C:\Users\geor                 ge\AppData\Local\Temp\SVM-5429191132714981263\AMD64LibCHelperDirectives.cpp /FeC:\Users\george\AppData\Local\Temp\SVM-5429191132714981263\AMD64LibCHelperDirectives                 .exe output included error: [AMD64LibCHelperDirectives.cpp, C:\Users\george\AppData\Local\Temp\SVM-5429191132714981263\AMD64LibCHelperDirectives.cpp(33): fatal error C1034: stdio.h: no include path set]

The only way I’ve gotten a clean compile in powershell is to:

  • Start cmd
  • run vcvars64.bat
  • start powershell from cmd
  • mvn package -Pnative

Like I said, it works, it’s just not ideal and requires some documentation.

@gsmet @gdoenlen I don’t think this is an issue any more. Let’s close it. Windows Quarkus native app build works just fine for me.

@geoand I managed to get around to testing this this morning and it does work, but it’s not really in an ideal form atm.

Some things to note:

  • Only works from cmd (this isn’t ideal as every developer I know on windows uses powershell).
  • Only works after manually running vcvars64.bat
  • The default project generates quarkus.platform.artifact-id as quarkus-universe-bom and I had to switch this to quarkus-bom for maven to find 1.3.0.CR2, I’m not sure if this is a bug with quarkus.io or if this is by design.

I know the first two issues are probably upstream problems with either Graal or Microsoft themselves, but if you want to drive adoption it’s probably something that should be worked on. I think for now there needs to be some sort of documentation somewhere on how to do the above process for windows users (maybe in here somewhere https://quarkus.io/guides/maven-tooling).

Thanks for keeping this a priority guys!

Environment:

OS: Microsoft Windows [Version 10.0.18362.719]
Java: 
  openjdk version "11.0.6" 2020-01-14
  OpenJDK Runtime Environment GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02)
  OpenJDK 64-Bit Server VM GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02, mixed mode, sharing)
VCVars: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build>vcvars64.bat
Project: default generated project from quarkus.io

**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.0
** Copyright (c) 2019 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools>whereis cl
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\bin\Hostx64\x64\cl.exe

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools>cd C:/users/george/desktop

C:\Users\george\Desktop>cd code-with-quarkus

C:\Users\george\Desktop\code-with-quarkus>mvn clean package -Pnative
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< org.acme:code-with-quarkus >---------------------
[INFO] Building code-with-quarkus 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ code-with-quarkus ---
[INFO] Deleting C:\Users\george\Desktop\code-with-quarkus\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ code-with-quarkus ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ code-with-quarkus ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\george\Desktop\code-with-quarkus\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ code-with-quarkus ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\george\Desktop\code-with-quarkus\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ code-with-quarkus ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to C:\Users\george\Desktop\code-with-quarkus\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ code-with-quarkus ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.acme.ExampleResourceTest
2020-03-12 09:13:56,317 INFO  [io.quarkus] (main) Quarkus 1.3.0.CR2 started in 1.273s. Listening on: http://0.0.0.0:8081
2020-03-12 09:13:56,318 INFO  [io.quarkus] (main) Profile test activated.
2020-03-12 09:13:56,318 INFO  [io.quarkus] (main) Installed features: [cdi, resteasy]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.404 s - in org.acme.ExampleResourceTest
2020-03-12 09:13:57,097 INFO  [io.quarkus] (main) Quarkus stopped in 0.021s
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ code-with-quarkus ---
[INFO] Building jar: C:\Users\george\Desktop\code-with-quarkus\target\code-with-quarkus-1.0.0-SNAPSHOT.jar
[INFO]
[INFO] --- quarkus-maven-plugin:1.3.0.CR2:build (default) @ code-with-quarkus ---
[INFO] [org.jboss.threads] JBoss Threads version 3.0.1.Final
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: C:\Users\george\Desktop\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\george\Desktop\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 GraalVM Version 20.0.0 CE
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] C:\Users\george\scoop\apps\graalvm\current\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 -J-Duser.language=en -J-Dfile.encoding=Cp1252 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -H:+JNI -jar code-with-quarkus-1.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:-IncludeAllTimeZones -H:EnableURLProtocols=http -H:-UseServiceLoaderFeature -H:+StackTrace code-with-quarkus-1.0.0-SNAPSHOT-runner
[code-with-quarkus-1.0.0-SNAPSHOT-runner:15204]    classlist:   2,415.90 ms,  1.27 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:15204]        (cap):   1,829.13 ms,  1.27 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:15204]        setup:   2,841.18 ms,  1.27 GB
09:14:08,315 INFO  [org.jbo.threads] JBoss Threads version 3.0.1.Final
[code-with-quarkus-1.0.0-SNAPSHOT-runner:15204]   (typeflow):   7,555.07 ms,  2.88 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:15204]    (objects):   6,607.83 ms,  2.88 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:15204]   (features):     252.82 ms,  2.88 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:15204]     analysis:  15,014.06 ms,  2.88 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:15204]     (clinit):     398.91 ms,  2.88 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:15204]     universe:     994.55 ms,  2.88 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:15204]      (parse):   1,369.05 ms,  2.88 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:15204]     (inline):   1,545.27 ms,  3.77 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:15204]    (compile):   8,111.35 ms,  3.77 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:15204]      compile:  11,972.74 ms,  3.77 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:15204]        image:   1,736.52 ms,  3.77 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:15204]        write:     421.54 ms,  3.77 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:15204]      [total]:  35,652.05 ms,  3.77 GB
[INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 39612ms
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  52.812 s
[INFO] Finished at: 2020-03-12T09:14:38-04:00
[INFO] ------------------------------------------------------------------------

@famod you can already use GraalVM 20.0 with Quarkus. I propose you give it a go 😃

When I take the printed command

C:\Develop\_tools\graal-default\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 modmono-quarkus-1.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http -H:+JNI -H:-UseServiceLoaderFeature -H:+StackTrace modmono-quarkus-1.0-SNAPSHOT-runner

and wrap every parameter that contains a = with "...=..." and execute it manually, the “Unknown arguments” error vanishes! (but I then hit https://github.com/oracle/graal/issues/1675 which shadows the real problem)

It seems Quarkus should do this wrapping automatically, at least on Windows.