bell-sw / LibericaNIK

Native Image Kit
4 stars 0 forks source link

JavaFX native executable generation on LINUX #4

Open java71 opened 5 months ago

java71 commented 5 months ago

Hi, probably not a bug but I don't understand...

I hava a "jar" that can be turned into "exe" on windows without any problem. I use LIBERICA native image for java21. The process is always the same:

On LINUX, the JDK execution with agent works properly. So it demonstrates that all librairies can be found. My problem is that, using native image, last step for cannot be processed. A series of missing library are mentionned /usr/bin/ld cannot find : -lfontconfig -lharfbuzz -lgtk-3 -lgdk-3 -lglib-2.0 -lgobject-2.0 -lgthread-2.0 -lgmodule-2.0 and son on....

Could you please explain what is missing, and why it works with JDK and not with native-image ? Many thanks !

petermz commented 5 months ago

This must mean all the libraries are installed on your system, and can be found by the runtime linker, but not by ld. I'm not sure what the reason might be. You might want to inspect the linker invocation command printed by native-image right before it fails, and check if there are any irregularities there.

java71 commented 5 months ago

Thanks Peter, I will try to investigate...Bye !!Gillesenvoyé : 23 janvier 2024 à 09:01de : Peter Zhelezniakov @.>à : bell-sw/Liberica @.>cc : java71 @.>, Author @.>objet : Re: [bell-sw/Liberica] JavaFX native executable generation on LINUX (Issue bell-sw/LibericaNIK#4) This must mean all the libraries are installed on your system, and can be found by the runtime linker, but not by ld. I'm not sure what the reason might be. You might want to inspect the linker invocation command printed by native-image right before it fails, and check if there are any irregularities there.—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

java71 commented 4 months ago

Hi Peter,As a poor LINUX developper, I have decided to install a 'VirtualBox' with UBUNTU on my Windows desktop :After machine creation, I have installed:1- LIBERICA ".deb" provided by web site2 - single dependency -> sudo apt install g++ make zlib1g-dev3 - Seems needed packages (after problem reported by NATIVE-IMAGE)---> libx11-dev---> libxtst-dev---> libfontconfig1-dev---> libharfbuzz-dev---> libgtk-3-dev---> libgdk3.0-cil---> libglib2.0-0---> libglib2.0-devPlease remaind that - When I run native -image in windows, there is no problem my 'jar' is correctly turned into native executable. So my JAR seems to be correct- When I run JAR with LIBERICA VM on LINUX, all works well !But when I run NATIVE-IMAGE in linux, with same 'jar', all steps run correctly until last step 8/8:-> At this last step, linker seems not to find these libraries : -lgtk-3 -lgdk-3 -lgdk_pixbuf-2.0 -lpango-1.0 -lpangocairo-1.0 -lpangoft2-1.0 -latk-1.0 -lGLIt is really strange because when I use command 'ld', each library seems to be correctly installed.Note also that before invoking native image I start the program for running it with AGENT for dynamic resources, I all works well !My questions are the following:- Does my installation process correct ? LIBERICA -> dependencies -> additionnal libraries- Is NATIVE-IMAGE supposed to work in such a simple configuration (JavaFX + static image) ?- Do you think about a possible problem that could make that NATIVE-IMAGE linker do NOT see some libraries wheres it sees other ones ?Thanks for your helpBest regards,gillesenvoyé : 23 janvier 2024 à 09:01de : Peter Zhelezniakov @.>à : bell-sw/Liberica @.>cc : java71 @.>, Author @.>objet : Re: [bell-sw/Liberica] JavaFX native executable generation on LINUX (Issue bell-sw/LibericaNIK#4) This must mean all the libraries are installed on your system, and can be found by the runtime linker, but not by ld. I'm not sure what the reason might be. You might want to inspect the linker invocation command printed by native-image right before it fails, and check if there are any irregularities there.—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

petermz commented 4 months ago

So I assume java -jar yourapp.jar is working for you, right? Try running java -Dprism.order=es2 -Dprism.verbose=true -jar yourapp.jar

java71 commented 4 months ago

Thanks for your reply !I confirm that first command line works properly.Second line lead to below error...--------------------------------------------------------------------------------------------------Prism pipeline init order: es2 Using Double Precision Marlin RasterizerUsing dirty region optimizationsNot using texture mask for primitivesNot forcing power of 2 sizes for texturesUsing hardware CLAMP_TO_ZERO modeOpting in for HiDPI pixel scalingPrism pipeline name = com.sun.prism.es2.ES2PipelineLoading ES2 native library ... prism_es2 succeeded.GLFactory using com.sun.prism.es2.X11GLFactory(X) Got class = class com.sun.prism.es2.ES2PipelineFailed Graphics Hardware Qualifier check.System GPU doesn't meet the es2 pipe requirementGraphicsPipeline.createPipeline: error initializing pipeline com.sun.prism.es2.ES2PipelineReason: could not create an instanceGraphics Device initialization failed for : es2Error initializing QuantumRenderer: no suitable pipeline foundjava.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:283) at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:253) at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:263) at javafx.graphics/javafx.scene.image.Image.(Image.java:745) at javafx.graphics/javafx.scene.image.WritableImage.(WritableImage.java:77) at javium.core.graphic.javafx.MyPlcHeadJavafx.createImage(IfHeadJavaFx.java:1417) at javium.core.graphic.javafx.MyPlcHeadJavafx.(IfHeadJavaFx.java:188) at javium.core.graphic.javafx.IfHeadJavaFx.create(IfHeadJavaFx.java:118) at javium.core.graphic.javafx.JaviumCoreGraphicJavafx.lambda$2(JaviumCoreGraphicJavafx.java:64) at javium.core.graphic.MainHead.lambda$2(MainHead.java:101) at javium.Javium.lambda$22(Javium.java:517) at javium.core.graphic.javafx.JaviumCoreGraphicJavafx.forEachAnnotatedStaticMethod(JaviumCoreGraphicJavafx.java:64) at javium.Javium.lambda$21(Javium.java:517) at javium.Javium.lambda$2(Javium.java:327) at java.base/java.util.Hashtable.forEach(Hashtable.java:893) at javium.Javium.forEachModule(Javium.java:327) at javium.Javium.forEachAnnotatedStaticMethod(Javium.java:515) at javium.core.graphic.MainHead.lambda$1(MainHead.java:99) at javium.core.list.IfHashW.get(IfHashW.java:69) at javium.core.list.MyHashStringW$.lambda$66(MyHashStringW$.java:408) at javium.core.list.MyHashStringW$.get(MyHashStringW$.java:411) at javium.core.list.MyHashStringW$.get(MyHashStringW$.java:1) at javium.core.graphic.MainHead.start(MainHead.java:95) at javium.ui.MainCrossword.mainCrosswordsJavafx(MainCrossword.java:98) at javium.ui.JaviumUi$MainCrosswordsJavafx.lambda$1(JaviumUi.java:336) at javium.core.action.MyLock.concatenate(IfLock.java:173) at javium.core.action.MyLock$.lambda$16(MyLock$.java:149) at javium.core.action.MyLock$.concatenate(MyLock$.java:152) at javium.ui.JaviumUi$MainCrosswordsJavafx.lambda$0(JaviumUi.java:336) at javium.Javium$MyMain.lambda$0(Javium.java:1800) at javium.Javium.checkActions(Javium.java:1739) at javium.Javium$MyMain.createMainConfiguration(Javium.java:1802) at javium.ui.JaviumUi$MainCrosswordsJavafx.main(JaviumUi.java:336)Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:95) at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125) at java.base/java.lang.Thread.run(Thread.java:1583)Exception in thread “main” java.lang.RuntimeException: No toolkit found at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:275) at javafx.graphics/javafx.scene.image.Image.(Image.java:745) at javafx.graphics/javafx.scene.image.WritableImage.(WritableImage.java:77) at javium.core.graphic.javafx.MyPlcHeadJavafx.createImage(IfHeadJavaFx.java:1417) at javium.core.graphic.javafx.MyPlcHeadJavafx.(IfHeadJavaFx.java:188) at javium.core.graphic.javafx.IfHeadJavaFx.create(IfHeadJavaFx.java:118) at javium.core.graphic.javafx.JaviumCoreGraphicJavafx.lambda$2(JaviumCoreGraphicJavafx.java:64) at javium.core.graphic.MainHead.lambda$2(MainHead.java:101) at javium.Javium.lambda$22(Javium.java:517) at javium.core.graphic.javafx.JaviumCoreGraphicJavafx.forEachAnnotatedStaticMethod(JaviumCoreGraphicJavafx.java:64) at javium.Javium.lambda$21(Javium.java:517) at javium.Javium.lambda$2(Javium.java:327) at java.base/java.util.Hashtable.forEach(Hashtable.java:893) at javium.Javium.forEachModule(Javium.java:327) at javium.Javium.forEachAnnotatedStaticMethod(Javium.java:515) at javium.core.graphic.MainHead.lambda$1(MainHead.java:99) at javium.core.list.IfHashW.get(IfHashW.java:69) at javium.core.list.MyHashStringW$.lambda$66(MyHashStringW$.java:408) at javium.core.list.MyHashStringW$.get(MyHashStringW$.java:411) at javium.core.list.MyHashStringW$.get(MyHashStringW$.java:1) at javium.core.graphic.MainHead.start(MainHead.java:95) at javium.ui.MainCrossword.mainCrosswordsJavafx(MainCrossword.java:98) at javium.ui.JaviumUi$MainCrosswordsJavafx.lambda$1(JaviumUi.java:336) at javium.core.action.MyLock.concatenate(IfLock.java:173) at javium.core.action.MyLock$.lambda$16(MyLock$.java:149) at javium.core.action.MyLock$.concatenate(MyLock$.java:152) at javium.ui.JaviumUi$MainCrosswordsJavafx.lambda$0(JaviumUi.java:336) at javium.Javium$MyMain.lambda$0(Javium.java:1800) at javium.Javium.checkActions(Javium.java:1739) at javium.Javium$MyMain.createMainConfiguration(Javium.java:1802) at @.:/home/papa/share# envoyé : 12 février 2024 à 15:15de : Peter Zhelezniakov @.>à : bell-sw/Liberica @.>cc : java71 @.>, Author @.>objet : Re: [bell-sw/Liberica] JavaFX native executable generation on LINUX (Issue bell-sw/LibericaNIK#4) So I assume java -jar yourapp.jar is working for you, right? Try running java -Dprism.order=es2 -Dprism.verbose=true -jar yourapp.jar—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.>

petermz commented 4 months ago

So it seems your system is missing those libraries, and the reason java -jar works is that it falls back to software pipeline. The easiest way to fix is probably sudo apt install openjfx which will install all the libraries as dependencies, then java -Dprism.order=es2 -Dprism.verbose=true -jar ... to see if it works, and if it does, try building a native image once again