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

CL.exe compilation errors not returned #1675

Closed
osmanrafiqss opened this issue Sep 12, 2019 · 9 comments
Closed

CL.exe compilation errors not returned #1675

osmanrafiqss opened this issue Sep 12, 2019 · 9 comments
Assignees

Comments

@osmanrafiqss
Copy link

When native-image compilation fails on Windows the error included is not very informative.

Consider the following example:

[getting-started-1.0-SNAPSHOT-runner:12224] classlist: 8,740.59 ms [getting-started-1.0-SNAPSHOT-runner:12224] (cap): 1,634.56 ms [getting-started-1.0-SNAPSHOT-runner:12224] setup: 2,111.65 ms Error: Error compiling query code (in C:\tmp\SVM-2783671696419126403\NativeInfoDirectives.cpp). Compiler command CL C:\tmp\SVM-2783671696419126403\NativeInfoDirectives.cpp /FeC:\tmp\SVM-2783671696419126403\NativeInfoDirectives.exe output included error: [Microsoft (R) C/C++ Optimizing Compiler Version 16.00.40219.01 for x64, Copyright (C) Microsoft Corporation. All rights reserved., ] com.oracle.svm.core.util.UserError$UserException: Error compiling query code (in C:\tmp\SVM-2783671696419126403\NativeInfoDirectives.cpp). Compiler command CL C:\tmp\SVM-2783671696419126403\NativeInfoDirectives.cpp /FeC:\tmp\SVM-2783671696419126403\NativeInfoDirectives.exe output included error: [Microsoft (R) C/C++ Optimizing Compiler Version 16.00.40219.01 for x64, Copyright (C) Microsoft Corporation. All rights reserved., ] at com.oracle.svm.core.util.UserError.abort(UserError.java:114)

I am by no means a Microsoft Compiler expert - but it seems that CL.exe writes compilation errors to stdout and compiler errors to stderr.

If I update substratevm to capture stdout when CL.exe exits with a non-zero error code - I get the following more informative error:

[getting-started-1.0-SNAPSHOT-runner:8848] classlist: 9,326.16 ms [getting-started-1.0-SNAPSHOT-runner:8848] (cap): 2,198.22 ms [getting-started-1.0-SNAPSHOT-runner:8848] setup: 2,802.02 ms Error: Error compiling query code (in C:\tmp\SVM-1270989077554696147\NativeInfoDirectives.cpp). Compiler command CL C:\tmp\SVM-1270989077554696147\NativeInfoDirectives.cpp /FeC:\tmp\SVM-1270989077554696147\NativeInfoDirectives.exe output included error: [NativeInfoDirectives.cpp, C:\tmp\SVM-1270989077554696147\NativeInfoDirectives.cpp(32) : fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory] com.oracle.svm.core.util.UserError$UserException: Error compiling query code (in C:\tmp\SVM-1270989077554696147\NativeInfoDirectives.cpp). Compiler command CL C:\tmp\SVM-1270989077554696147\NativeInfoDirectives.cpp /FeC:\tmp\SVM-1270989077554696147\NativeInfoDirectives.exe output included error: [NativeInfoDirectives.cpp, C:\tmp\SVM-1270989077554696147\NativeInfoDirectives.cpp(32) : fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory]

I have spent a few days figuring out why native-image compilation when using Quarkus was failing on my setup - having a more informative error message would really be helpful.

@olpaw
Copy link
Member

olpaw commented Dec 19, 2019

@dougxc added some improvements in error handling of native-compilation issues. Can you still reproduce this problem?

@famod
Copy link

famod commented Jan 25, 2020

Seeing the same not very helpful error message with graalvm-ce-java11-19.3.1:

[modmono-quarkus-1.0-SNAPSHOT-runner:17584]    classlist:   3,943.13 ms
[modmono-quarkus-1.0-SNAPSHOT-runner:17584]        (cap):     798.64 ms
[modmono-quarkus-1.0-SNAPSHOT-runner:17584]        setup:   1,134.50 ms
Error: Error compiling query code (in C:\Develop\Temp\SVM-5228049311242870963\NativeInfoDirectives.cpp). Compiler command  CL C:\Develop\Temp\SVM-5228049311242870963\NativeInfoDirectives.cpp /FeC:\Develop\Temp\SVM-5228049311242870963\NativeInfoDirectives.exe output included error: [Microsoft (R) C/C++-Optimierungscompiler Version 19.16.27035 f?r x64, Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten., ]
com.oracle.svm.core.util.UserError$UserException: Error compiling query code (in C:\Develop\Temp\SVM-5228049311242870963\NativeInfoDirectives.cpp). Compiler command  CL C:\Develop\Temp\SVM-5228049311242870963\NativeInfoDirectives.cpp /FeC:\Develop\Temp\SVM-5228049311242870963\NativeInfoDirectives.exe output included error: [Microsoft (R) C/C++-Optimierungscompiler Version 19.16.27035 f?r x64, Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten., ]
        at com.oracle.svm.core.util.UserError.abort(UserError.java:114)
        at com.oracle.svm.hosted.c.NativeLibraries.reportErrors(NativeLibraries.java:218)
        at com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeImageGenerator.java:1518)
        at com.oracle.svm.hosted.NativeImageGenerator.setupNativeLibraries(NativeImageGenerator.java:1006)
        at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:835)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:528)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:445)
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
Error: Image build request failed with exit status 1

Invocation:

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

@olpaw
Copy link
Member

olpaw commented Jan 27, 2020

Seeing the same not very helpful error message with graalvm-ce-java11-19.3.1

Hi @famod I recently came across the query code compilation bits and fixed that on master (d537daf).
This change will also be in the 20.0.0 release.

@famod
Copy link

famod commented Jan 27, 2020

Hi @olpaw, thanks for letting me know.
I suppose I don't have any chance to get more info with 19.3.1?

@olpaw
Copy link
Member

olpaw commented Jan 27, 2020

any chance to get more info with 19.3.1?

It should also be possible by using -H:TempDirectory=myknownpath. This will prevent temporary files from getting deleted. That way you are able to replay the linker command on the Windows command prompt. (Copy the linker command from the error message (Compiler command CL .....) and paste it into the windows command prompt window)

@famod
Copy link

famod commented Jan 27, 2020

Thanks @olpaw! This revealed that I am having the same problem as @osmanrafiqss (unistd.h is missing).

@jamesward
Copy link

I'm now running into this issue as well:

[error] com.oracle.svm.core.util.UserError$UserException: Error compiling query code (in C:\Users\RUNNER~1\AppData\Local\Temp\SVM-16139828719774904515\NativeInfoDirectives.c). Compiler command ''C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe' /WX /W4 /wd4244 /wd4245 /wd4800 /wd4804 /wd4214 '/FeC:\Users\RUNNER~1\AppData\Local\Temp\SVM-16139828719774904515\NativeInfoDirectives.exe' 'C:\Users\RUNNER~1\AppData\Local\Temp\SVM-16139828719774904515\NativeInfoDirectives.c'' output included error: [NativeInfoDirectives.c, C:\Users\RUNNER~1\AppData\Local\Temp\SVM-16139828719774904515\NativeInfoDirectives.c(11): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory]

This is in a GitHub Action:
https://github.com/EffectOrientedProgramming/book/blob/e7b90498c085346f5ccce0fc17726e54a5a51826/.github/workflows/booker.yml#L31-L64

Any ideas?

@2m
Copy link

2m commented Aug 22, 2021

I also get this error with GraalVM 21.2.0 (job logs), 21.1.0 (job logs).

Strangely in 21.0.0.2 and 20.3.3 the cl.exe executable fails, but GitHub Actions job succeeds (job logs).

@discordgr
Copy link

discordgr commented Nov 24, 2021

Just leaving this here in case it helps someone:

Edit: I also manually located vcvars.bat file and run it but i'm not sure whether it helped. Part 3 of the article tells you where vcvars is located

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

No branches or pull requests

6 participants