gluonhq / substrate

Create native Java(FX) apps for desktop, mobile and embedded
GNU General Public License v2.0
400 stars 51 forks source link

Extend AWT support (Linux) #908

Open jperedadnr opened 3 years ago

jperedadnr commented 3 years ago

905 added AWT libraries, but in headless mode. awt_xawt and other libraries are required for java.awt.Desktop or Swing support, in heady mode.

Expected Behavior

Current Behavior

Steps to Reproduce

Your Environment

alaa-az commented 3 years ago

This worked for me: jvm, libchelper, fontmanager, javajpeg, lcms, jawt, awt_xawt, awt

DJViking commented 2 years ago

Unable to build my JavaFX application that uses a Swing library (NASA WorldWind).

Using Java 17, JavaFX 17, Gluon GraalVM 22.0.0.3 graalvm-svm-java17-linux-gluon-22.0.0.3-Final

Is there anything I can do, configure/link this during build? Would be nice if graalfx plugin could do this if/when Swing is used.

[SUB]     Context obj com.oracle.svm.hosted.phases.AnalysisGraphBuilderPhase@2bd4d3b6
[SUB]     Context obj StructuredGraph:57745{AnalysisMethod<sun.awt.X11.XMenuPeer.dispose -> HotSpotMethod<XMenuPeer.dispose()>>}
[SUB]     Context obj AnalysisMethod<sun.awt.X11.XMenuPeer.dispose -> HotSpotMethod<XMenuPeer.dispose()>>
[SUB] [thread:50] scope: ForkJoinPool-2-worker-8
[SUB]   [thread:50] scope: ForkJoinPool-2-worker-8.ClosedWorldAnalysis
[SUB]   Context: StructuredGraph:57751{AnalysisMethod<sun.awt.X11.XMenuPeer.addItem -> HotSpotMethod<XMenuPeer.addItem(MenuItem)>>}
[SUB]   Context: AnalysisMethod<sun.awt.X11.XMenuPeer.addItem -> HotSpotMethod<XMenuPeer.addItem(MenuItem)>>
[SUB]     [thread:50] scope: ForkJoinPool-2-worker-8.ClosedWorldAnalysis.AnalysisGraphBuilderPhase
[SUB]     Exception raised in scope ForkJoinPool-2-worker-8.ClosedWorldAnalysis.AnalysisGraphBuilderPhase: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported type sun.awt.X11.XBaseWindow is reachable
[SUB]     To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
[SUB]           at parsing sun.awt.X11.XMenuPeer.addItem(XMenuPeer.java:113)
[SUB]           at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.throwParserError(BytecodeParser.java:2660)
[SUB]           at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.throwParserError(SharedGraphBuilderPhase.java:106)
[SUB]           at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3521)
[SUB]           at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3473)
[SUB]           at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3318)
[SUB]           at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1149)
[SUB]           at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1041)
[SUB]           at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:84)
[SUB]           at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:80)
[SUB]           at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
[SUB]           at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:214)
[SUB]           at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
[SUB]           at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
[SUB]           at com.oracle.graal.pointsto.flow.AnalysisParsedGraph.parseBytecode(AnalysisParsedGraph.java:132)
[SUB]           at com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsed(AnalysisMethod.java:556)
[SUB]           at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:167)
[SUB]           at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:358)
[SUB]           at com.oracle.graal.pointsto.flow.MethodTypeFlow.createTypeFlow(MethodTypeFlow.java:297)
[SUB]           at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureTypeFlowCreated(MethodTypeFlow.java:286)
[SUB]           at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:107)
[SUB]           at com.oracle.graal.pointsto.DefaultAnalysisPolicy$DefaultVirtualInvokeTypeFlow.onObservedUpdate(DefaultAnalysisPolicy.java:223)
[SUB]           at com.oracle.graal.pointsto.flow.TypeFlow.notifyObservers(TypeFlow.java:487)
[SUB]           at com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:556)
[SUB]           at com.oracle.graal.pointsto.PointsToAnalysis$2.run(PointsToAnalysis.java:598)
[SUB]           at com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:195)
[SUB]           at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:179)
[SUB]           at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
[SUB]           at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
[SUB]           at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
[SUB]           at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
[SUB]           at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
[SUB]           at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
[SUB]     Caused by: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported type sun.awt.X11.XBaseWindow is reachable
[SUB]     To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
[SUB]           at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.lookup(AnnotationSubstitutionProcessor.java:120)
[SUB]           at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:125)
[SUB]           at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:125)
[SUB]           at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:202)
[SUB]           at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:182)
[SUB]           at com.oracle.graal.pointsto.meta.AnalysisType.<init>(AnalysisType.java:184)
[SUB]           at com.oracle.graal.pointsto.meta.AnalysisUniverse.createType(AnalysisUniverse.java:266)
[SUB]           at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:205)
[SUB]           at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:182)
[SUB]           at com.oracle.graal.pointsto.meta.AnalysisType.<init>(AnalysisType.java:184)
[SUB]           at com.oracle.graal.pointsto.meta.AnalysisUniverse.createType(AnalysisUniverse.java:266)
[SUB]           at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:205)
[SUB]           at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:182)
[SUB]           at com.oracle.graal.pointsto.meta.AnalysisType.<init>(AnalysisType.java:184)
[SUB]           at com.oracle.graal.pointsto.meta.AnalysisUniverse.createType(AnalysisUniverse.java:266)
[SUB]           at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:205)
[SUB]           at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:182)
[SUB]           at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:71)
[SUB]           at com.oracle.graal.pointsto.infrastructure.WrappedSignature.getReturnType(WrappedSignature.java:75)
[SUB]           at com.oracle.graal.pointsto.flow.MethodFlowsGraph.<init>(MethodFlowsGraph.java:109)
[SUB]           at com.oracle.graal.pointsto.flow.MethodTypeFlow.<init>(MethodTypeFlow.java:74)
[SUB]           at com.oracle.graal.pointsto.meta.PointsToAnalysisMethod.<init>(PointsToAnalysisMethod.java:51)
[SUB]           at com.oracle.graal.pointsto.meta.PointsToAnalysisFactory.createMethod(PointsToAnalysisFactory.java:32)
[SUB]           at com.oracle.graal.pointsto.meta.AnalysisUniverse.createMethod(AnalysisUniverse.java:434)
[SUB]           at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:422)
[SUB]           at com.oracle.graal.pointsto.infrastructure.WrappedConstantPool.lookupMethod(WrappedConstantPool.java:125)
[SUB]           at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.lookupMethodInPool(BytecodeParser.java:4364)
[SUB]           at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.lookupMethodInPool(SharedGraphBuilderPhase.java:134)
[SUB]           at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.lookupMethod(BytecodeParser.java:4358)
[SUB]           at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeVirtual(BytecodeParser.java:1716)
[SUB]           at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5407)
[SUB]           at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3513)
[SUB]           ... 29 more
[SUB]     

[SUB] Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported type sun.awt.X11.XBaseWindow is reachable
[SUB] To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
[SUB] Trace: 
[SUB]   at parsing sun.awt.X11.XWrapperBase.getWindow(XWrapperBase.java:57)
[SUB] Call path from entry point to sun.awt.X11.XWrapperBase.getWindow(long): 
[SUB]   at sun.awt.X11.XWrapperBase.getWindow(XWrapperBase.java:57)
[SUB]   at sun.awt.X11.XButtonEvent.getFieldsAsString(XButtonEvent.java:84)
[SUB]   at sun.awt.X11.XWrapperBase.toString(XWrapperBase.java:37)
[SUB]   at sun.awt.X11.XSetWindowAttributes.toString(XSetWindowAttributes.java:8)
[SUB]   at javax.swing.UIDefaults$TextAndMnemonicHashMap.get(UIDefaults.java:1358)
[SUB]   at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VARARGS_Map_get_8ad0e685e422456d1fb5c284610866cdf0c04ffe(generated:0)
[SUB] 
[SUB]   at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:129)
[SUB]   at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:728)
[SUB]   ... 6 more