问题
I try to use a JavaFX application on a Raspberry Pi 3 B+ with a small display connected to the display port. But this throws an error on startup of the application.
Maybe first some quick questions to get started:
- Is the display port supported by JavaFX? Because this is the first time I use it instead of HDMI.
- Or is OpenJFX 16ea only for Raspberry Pi 4?
I downloaded latest openjfx from https://gluonhq.com/products/javafx/.
This is my startup command to run the (Maven) compiled application:
sudo java -Dmonocle.egl.lib=/opt/arm32fb-sdk/lib/libgluon_drm.so \
-Djava.library.path=/opt/arm32fb-sdk/lib \
-Dmonocle.platform.traceConfig=true \
-Dmonocle.platform=EGL \
-Dprism.verbose=true \
-Djavafx.verbose=true \
-p /opt/arm32fb-sdk/lib \
--add-modules javafx.controls \
-jar javafx-ui-1.0.0-SNAPSHOT-jar-with-dependencies.jar
This is the error output:
$ bash start_on_raspberrypi.sh
JavaFX launchApplication method: launchMode=LM_JAR
Prism pipeline init order: es2 sw
Using Double Precision Marlin Rasterizer
Using dirty region optimizations
Using system sized mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.es2.ES2Pipeline
Loading ES2 native library ... prism_es2_monocle
WARNING: java.lang.UnsatisfiedLinkError: /opt/arm32fb-sdk/lib/libprism_es2_monocle.so: libGLESv2.so.2: cannot open shared object file: No such file or directory
GraphicsPipeline.createPipeline failed for com.sun.prism.es2.ES2Pipeline
java.lang.UnsatisfiedLinkError: /opt/arm32fb-sdk/lib/libprism_es2_monocle.so: libGLESv2.so.2: cannot open shared object file: No such file or directory
at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2442)
at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2498)
at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2694)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2659)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
at java.base/java.lang.System.loadLibrary(System.java:1873)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:163)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:53)
at javafx.graphics/com.sun.prism.es2.ES2Pipeline.lambda$static$0(ES2Pipeline.java:69)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.prism.es2.ES2Pipeline.<clinit>(ES2Pipeline.java:51)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at javafx.graphics/com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
at java.base/java.lang.Thread.run(Thread.java:834)
*** Fallback to Prism SW pipeline
Prism pipeline name = com.sun.prism.sw.SWPipeline
Loaded /opt/arm32fb-sdk/lib/./libprism_sw.so from relative path
(X) Got class = class com.sun.prism.sw.SWPipeline
Initialized prism pipeline: com.sun.prism.sw.SWPipeline
JavaFX: using com.sun.javafx.tk.quantum.QuantumToolkit
traceConfig: Trying platform EGL with class com.sun.glass.ui.monocle.EGLPlatformFactory
WARNING: java.lang.UnsatisfiedLinkError: /opt/arm32fb-sdk/lib/libglass_monocle.so: libgbm.so.1: cannot open shared object file: No such file or directory
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: /opt/arm32fb-sdk/lib/libglass_monocle.so: libgbm.so.1: cannot open shared object file: No such file or directory
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:290)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:269)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:409)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
... 5 more
Caused by: java.lang.UnsatisfiedLinkError: /opt/arm32fb-sdk/lib/libglass_monocle.so: libgbm.so.1: cannot open shared object file: No such file or directory
at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2442)
at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2498)
at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2694)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2659)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
at java.base/java.lang.System.loadLibrary(System.java:1873)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:163)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:53)
at javafx.graphics/com.sun.glass.ui.monocle.LinuxSystem.loadLibrary(LinuxSystem.java:76)
at javafx.graphics/com.sun.glass.ui.monocle.LinuxPlatform.<init>(LinuxPlatform.java:32)
at javafx.graphics/com.sun.glass.ui.monocle.EGLPlatform.<init>(EGLPlatform.java:34)
at javafx.graphics/com.sun.glass.ui.monocle.EGLPlatformFactory.createNativePlatform(EGLPlatformFactory.java:46)
at javafx.graphics/com.sun.glass.ui.monocle.NativePlatformFactory.getNativePlatform(NativePlatformFactory.java:112)
at javafx.graphics/com.sun.glass.ui.monocle.MonocleApplication.<init>(MonocleApplication.java:49)
at javafx.graphics/com.sun.glass.ui.monocle.MonoclePlatformFactory.createApplication(MonoclePlatformFactory.java:42)
at javafx.graphics/com.sun.glass.ui.Application.run(Application.java:144)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:280)
回答1:
The 16-ea builds of JavaFX should also work on the Pi3 (and on a number of other arm-based systems). However, the monocle platform you have to use depends on the drivers that are installed on the system. If you choose the EGL platform with the DRM library, your system needs to have the required libraries (e.g. libgbm.so), which come pre-installed with the Pi4 and the latest Raspberry Pi OS.
If you are using a window manager, you shouldn't use monocle for this, but GTK:
-Dglass.platform=gtk
回答2:
Seemed I was having two problems:
1 - I started with a Raspberry Lite OS without Desktop, so first had to install X11
$ sudo apt install xserver-xorg
$ sudo apt install raspberrypi-ui-mods
$ sudo apt install lightdm
$ sudo reboot
2 - For the Raspberry Pi 3 not Monocle should be used, but GTK. This start script works:
sudo java \
-Dglass.platform=gtk \
-Dprism.verbose=true \
-Djavafx.verbose=true \
-p /opt/arm32fb-sdk/lib \
--add-modules javafx.controls \
-jar javafx-ui-1.0.0-SNAPSHOT-jar-with-dependencies.jar
来源:https://stackoverflow.com/questions/65389228/openjfx-16ea-on-pi-3-throws-unsatisfiedlinkerror-for-libprism-es2-monocle-so-li