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

fix: use native api to enable windows ansi support #4103

Closed
wants to merge 1 commit into from

Conversation

maxandersen
Copy link
Member

Why:

  • cmd.exe and powershell does not enable ansi without native tweaking.

This change addreses the need by:

  • use Graalvm native support to call out to native setConsoleMode()

Fixes #4095

Why:

 * cmd.exe and powershell does not enable ansi without native tweaking.

This change addreses the need by:

 * use Graalvm native support to call out to native setConsoleMode()

Fixes quarkusio#4095
@Platforms(Platform.WINDOWS.class)
public class WindowsConsoleDirectives implements CContext.Directives {

private static final String[] windowsLibs = new String[] { "<windows.h>" };
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently I'm getting an error I highly assumes is missing header files but not sure.
Error is:

Error: Error compiling query code (in C:\Users\max\AppData\Local\Temp\SVM-3772467201033451472\NativeInfoDirectives.cpp). Compiler command  CL C:\Users\max\AppData\Local\Temp\SVM-3772467201033451472\NativeInfoDirectives.cpp /FeC:\Users\max\AppData\Local\Temp\SVM-3772467201033451472\NativeInfoDirectives.exe output included error: [Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64, Copyright (C) Microsoft Corporation.  All rights reserved., ]
com.oracle.svm.core.util.UserError$UserException: Error compiling query code (in C:\Users\max\AppData\Local\Temp\SVM-3772467201033451472\NativeInfoDirectives.cpp). Compiler command  CL C:\Users\max\AppData\Local\Temp\SVM-3772467201033451472\NativeInfoDirectives.cpp /FeC:\Users\max\AppData\Local\Temp\SVM-3772467201033451472\NativeInfoDirectives.exe output included error: [Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64, Copyright (C) Microsoft Corporation.  All rights reserved., ]
        at com.oracle.svm.core.util.UserError.abort(UserError.java:114)
        at com.oracle.svm.hosted.c.NativeLibraries.reportErrors(NativeLibraries.java:196)
        at com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeImageGenerator.java:1512)
        at com.oracle.svm.hosted.NativeImageGenerator.setupNativeLibraries(NativeImageGenerator.java:993)
        at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:827)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:520)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:440)
        at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
        at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error: Image build request failed with exit status 1

waiting for oracle/graal#1675 to be fixed or someone magically figuring out what is wrong ;)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you show the content of C:\Users\max\AppData\Local\Temp\SVM-3772467201033451472\NativeInfoDirectives.cpp?

@geoand
Copy link
Contributor

geoand commented Sep 19, 2019

The error seems totally unrelated:

[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.53 s - in io.quarkus.mongodb.ListDatabaseTest
[INFO] Running io.quarkus.mongodb.CollectionManagementTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.192 s <<< FAILURE! - in io.quarkus.mongodb.CollectionManagementTest
[ERROR] io.quarkus.mongodb.CollectionManagementTest  Time elapsed: 0.192 s  <<< ERROR!
java.io.IOException: Cannot run program "/home/vsts/work/1/s/extensions/mongodb-client/runtime/target/extract-8f530c8a-e390-4890-9000-a22e3b880febextractmongod": error=26, Text file busy
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
	at de.flapdoodle.embed.process.runtime.ProcessControl.start(ProcessControl.java:213)
	at de.flapdoodle.embed.process.runtime.AbstractProcess.<init>(AbstractProcess.java:99)
	at de.flapdoodle.embed.mongo.AbstractMongoProcess.<init>(AbstractMongoProcess.java:53)
	at de.flapdoodle.embed.mongo.MongodProcess.<init>(MongodProcess.java:50)
	at de.flapdoodle.embed.mongo.MongodExecutable.start(MongodExecutable.java:44)
	at de.flapdoodle.embed.mongo.MongodExecutable.start(MongodExecutable.java:34)
	at de.flapdoodle.embed.process.runtime.Executable.start(Executable.java:108)
	at io.quarkus.mongodb.MongoTestBase.startMongoDatabase(MongoTestBase.java:62)

and looks similar to this issue.

Since this is totally out of our control, I'm just going to restart the failing tests.

@geoand
Copy link
Contributor

geoand commented Sep 19, 2019

For some reason Github won't let me restart the tests

Copy link
Member

@dmlloyd dmlloyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't yet build for Max so I won't approve it yet because there's a problem with it, we just don't know what the problem is yet.

@gsmet
Copy link
Member

gsmet commented Sep 21, 2019

I don't know if it works but at least it builds now :). Has the status of this PR changed or is it still a draft?

@maxandersen
Copy link
Member Author

maxandersen commented Sep 21, 2019

still a draft - blocked by what seems like quarkus triggering need of <unistd.h> api which does not exist on Windows thus at the moment we can't compile natively on windows (note: this also happens in master without this patch :).

@osmanrafiqss
Copy link

Seems like we are running into the same problems trying to build Quarkus native-image on Windows :D

The <unitstd.h> error is caused by a substitution in wildfly-common:
wildfly/wildfly-common#49

However, solving that issue will only lead you to the next problem of missing JVM Signal functionality for Windows in Graal :)

@maxandersen
Copy link
Member Author

Seems like we are running into the same problems trying to build Quarkus native-image on Windows :D

Yeah :)

how did you locate your source of unitstd.h usage ? I tried to get GraalVM to dump more logs but the call tree analysis happens after this error making it tricky to pinpoint.

Would be great to at least identify which missing pieces we are dependent on - and wether they are things we can fix or need fixing in Graal.

@osmanrafiqss
Copy link

I ended up just adding a System.out.println to the QueryCodeWriter visitor in Graal and printing out the Directives class and which header it includes :)

I agree - having a set of issues to monitor the progress of Windows support would be great.

@cescoffier
Copy link
Member

cescoffier commented Nov 12, 2019

@maxandersen what's the status of this PR?

@maxandersen
Copy link
Member Author

Waiting on graalvm's window support to improve enough so quarkus apps can be built on windows.

@gsmet gsmet added the triage/on-ice Frozen until external concerns are resolved label Nov 27, 2019
@gsmet
Copy link
Member

gsmet commented Oct 12, 2020

Closing as out of date.

@gsmet gsmet closed this Oct 12, 2020
@gsmet gsmet added the triage/out-of-date This issue/PR is no longer valid or relevant label Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/on-ice Frozen until external concerns are resolved triage/out-of-date This issue/PR is no longer valid or relevant
Projects
None yet
Development

Successfully merging this pull request may close these issues.

On Windows in native mode detect proper color handling
7 participants