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

Graal AOT compilation not working, probably due to the JFX plugin #156

Open
UtilFunction opened this issue Sep 21, 2023 · 4 comments
Open

Comments

@UtilFunction
Copy link

I have reason to believe that there is a problem with the javafx-gradle-plugin that causes it not to work with Graal Native.

To compile a JavaFX application natively, one usually needs to run an application with Graal's tracing agent to generate configuration files that can then be provided to the Graal compiler.

This works with both Maven and even Scala's sbt, but when doing this with a Gradle project, this error occurs:
Graphics device initialization failed for : d3d, sw or rather Graphics device initialization failed for : es2, sw.

Gluon will tell you to use the Gluon plugin instead of the Graal plugin, but that shouldn't be necessary at all, because as I mentioned before, it works with both sbt and Maven and even with Gluon's Gradle plugin it won`t work and you have to switch to SWRendering.

@natsufumij
Copy link

I wrote a project that worked through JavaFX's media module, Native Image, and was working with the media module. If you are interested, you can come to my Repository:
https://github.com/natsufumij/javafx-native-media-demo

@UtilFunction
Copy link
Author

I wrote a project that worked through JavaFX's media module, Native Image, and was working with the media module. If you are interested, you can come to my Repository: https://github.com/natsufumij/javafx-native-media-demo

That's not a Gradle project. Maven works just fine as I've described in my OP.

@Hugolarson
Copy link

Hi,
Please elaborate on how you manage to build javaFX native image with this plugin.
Which version of Graal you you using?

I thought this could only be accomplished with https://github.com/gluonhq/gluonfx-maven-plugin/

Thanks

@damnms
Copy link

damnms commented Sep 27, 2023

not sure if i have the exact same problem, but somehow feels its going to the same direction:

oli@fedora:~/IdeaProjects/chatclient/build/native/nativeCompile$ ./chatclient 
Sept. 27, 2023 2:38:03 PM com.sun.javafx.application.PlatformImpl startup
WARNUNG: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @10bdf5e5'
java.lang.ClassNotFoundException: com.sun.javafx.tk.quantum.QuantumToolkit
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:122)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:86)
	at java.base@21/java.lang.Class.forName(DynamicHub.java:1346)
	at java.base@21/java.lang.Class.forName(DynamicHub.java:1335)
	at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:253)
	at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:290)
	at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:162)
	at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:651)
	at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:671)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
	at java.base@21/java.lang.Thread.runWith(Thread.java:1596)
	at java.base@21/java.lang.Thread.run(Thread.java:1583)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:833)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:211)
Exception in thread "main" java.lang.RuntimeException: No toolkit found
	at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:275)
	at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:290)
	at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:162)
	at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:651)
	at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:671)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
	at java.base@21/java.lang.Thread.runWith(Thread.java:1596)
	at java.base@21/java.lang.Thread.run(Thread.java:1583)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:833)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:211)

the source is available at https://gitlab.com/olze/chatclient - i am kinda lost and give up with graalvm for now (again...)

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

No branches or pull requests

4 participants