Yocto - run QML app on Raspberry Pi 3
-
Hi,
I built my core-image-base Yocto (dunfell) image for Raspberry Pi 3. I included Qt5 to build with it and also my Qt5 app to build with it. I can run Qt console app but unfortunately QML app fails with:qt.qpa.xcb: could not connect to display qt.qpa.plugin: Could not load the Qt platform plugin xcb" in "" even though it was found. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix the problem. Available platform plugins are: minimal, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.
My recipe for QML app:
SUMMARY = "QT Example Recipe" LICENSE = "CLOSED" SRC_URI = "file://app2.pro \ file://app2.cpp \ file://qml.qrc \ file://main.qml" DEPENDS += "qtbase \ qtdeclarative \ qtquickcontrols" RDEPENDS_${PN} += "qtwayland" do_install_append() { install -d ${D}/opt/app2/ install -m 0755 app2 ${D}/opt/app2/ } FILES_${PN} += "/opt/app2/" S = "${WORKDIR}" inherit qmake5
And my local.conf is almost default, I just added this to it:
IMAGE_INSTALL += " \ ${Qt_UTILS} \ " Qt_UTILS = " \ qtbase \ qtbase-tools \ qtdeclarative \ qtquickcontrols \ qtquickcontrols2 \ "
I think all other settings in yocto build are default ones.
How can I enable my QML app to run on Raspberry Pi 3?
-
-
-
@MartinD said in Yocto - run QML app on Raspberry Pi 3:
qt.qpa.xcb: could not connect to display
This indicates that no X11 server is running.
Is that the case?
Do you want to use X11 or Wayland? -
@jsulm Thanks for your reply. Not sure what is better for me. I just want to display my QML app fullscreen on RPi HDMI 1280 x 800 display. No other app with UI will run on RPi. My app is graphically mainly static, some basic animations done in QML are possible.
-
@jsulm For now, I tried wayland. I added this to my local.conf:
DISTRO_FEATURES_remove = "x11" DISTRO_FEATURES:append = " wayland" CORE_IMAGE_EXTRA_INSTALL += "wayland weston"
I when running my app, I get almost the same error:
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix the problem. Available platform plugins are: eglfs, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland.
I then tried to run my app:
./myapp -platform wayland
I get this error:
error: XDG_RUNTIME_DIR not set in the environment. Failed to create wl_display (No such file or directory) qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix the problem. Available platform plugins are: eglfs, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland.
-
@jsulm I made some progress. Updated my local.conf:
IMAGE_INSTALL += " \ weston \ "
Now, when I call "weston", I get this error:
fatal: drm backend should be run using weston-launch binary, or your system should provide the logind D-Bus API. fatal: failed to create compositor backed
When I call "weston-launch", I get this error:
weston: westonlaunch must be run from a virtual terminal
When I call "weston-launch -t tty4", I get this error:
weston: -t/-tty option requires -u/--user option as well
When I call "weston-launch -t tty4 -u root", I get this error:
weston: -u is unsupported in this weston-launch build
When I call "weston-launch -h", there is no option -u/--user in the list.
So for now, I'm stuck, because it tells me to use -u option and at the same time it tells me -u option is not available.
-
@MartinD said in Yocto - run QML app on Raspberry Pi 3:
I can run Qt console app but unfortunately QML app fails
- What do you see on your Raspberry Pi's screen before you launch your app?
- How do you launch your app? Is your keyboard plugged directly into your RPi, or are you doing it over SSH?
-
@JKSH said in Yocto - run QML app on Raspberry Pi 3:
- What do you see on your Raspberry Pi's screen before you launch your app?
-
@JKSH I see this:
160" I 2-9236551 bcm2835 -power Ilm2835 -power: Broadcom BCM2835 power domain,' -iu - I 2.9323671 mmc-bcm2835 3f300000.mmcnr: mmc debug:0 mmc d b 2° ul 2_938169] Indeed it is in host mode hprt0-= 00021501 - e ug 2.939429] mmc-bcm2835 3f300000.mmcnr: DMA ch 2.398119] mmcl: queuing unknown CIS tuple Oxannel allocated80 (2 bytes) 3.006606] sdhost: l ogbuf @ (ptrual) (ded07000) 3.013929] mmcl: queuing unknown CIS tuple Ox80 t 3.0280681 random: fast init done (3 bytes) 3.0423251 mmc1: queuing unknown CIS tuple Ox80 (3 bytes) 3.0523041 mmc 1: queuing unknown CIS tuple Ox80 (7 bytes) E 3.075678] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1) [ 3.085254] of_cfs_init 3.092400] of_cfs_init: OE 1 3.100739] Waiting for root device /deu/mmcb1k0p2... 1_ 3.1428691 mmc0: host does not support reading read-only switch, assuming wri te- enab le E 3.1479981 usb 1-1: new high-speed USB device number 2 using dwc_otg E. 3.1543381 mmc0: new high speed SDHC card at address 0002 [ 3.1569391 Indeed it is in host mode hprt0 = 00001101 [ 3.1652301 mmcblk0: mmc0:0002 NCard 14.9 GiB 3.199846] mmcblk0: p1 p2 E 3.2227781 mmc1: new high speed SDIU card at address 0001 3.2428281 EXT4-fs (mmcblkOp2): INFO : recovery required on readonly filesystem 3.2500381 EXT4-fs (mmcblkOp2): write access will be enabled during recovery 1. 1=1256311 EXT4-fs (mmcblk0p2): recovery complete [ 3.3447421 EXT4-fs (mmcblkOpZ): mounted filesystem with ordered data mode. Opts: (null) [ 3.3518861 UFS: Mounted root (ext4 filesystem) readonly on device 179:2. 3.359713] deutmpfs: mounted 3.374790] Freeing unused kernel memory : 102414 1.382363] Run /sbin/init as init process I 3.393450] Run /etc/init as init process [ 3.4013601 Run /bin/init as knit process 1.4096661 Run /bin/sh as init process 1.4183631 usb 1-1: New USB device found, tdVend_41r- 424, idProduct=9514, bcdDeuice= 2.00 I 3.4Z55551 usb 1-1: New USB device strings.. Mfr= O, Product=0, SerialNumber=0 [ 3.433660] hub 1-1:1.0: USB hub found I 3.440864] hub 1-1:1.0: 5 ports detected sh: cannot set terminal process group (-1): Inappropriate ioctl for device sh: no job control in this shell sh-5.0# L 3.767996] usb 1-1.1: new high-speed USB device number 3 using dwc_otg E. 3.8383201 usb 1-1.1: New USB deuice found, idUendor=0424, idProduct=ec00, bcdDeuice= 2.00 L 3.3054031 usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3.915483] snsc35xx u1.0.6 4.0124371 smsc95xx 1-1.1:1.0 etb0: register 'smsc95xx' at usb -3f980000.usb -1.1, smsc95xx USD 2.0 Ethernet, b6:27:eb:Oc:69:72 4.317'3'86] usb 1-1.2: new loot-speed USB deuice number 4 using dwc_otg 4.517616] usb 1-1.2: lien USB deuice found, idUendor=04d9, idProduct=a06b, bcdDeuice= 3.01 4.525232] usb 1-1 2: New USB device strings: Plfr=1, Product-2, SerialNumber=0 4.532890] usb 1-1.2: Product= Wireless USD Deuice E 4.576755 input: HOLTEK Wireless USB Device as /deuices/platform/soc/3f900000.usb/usb1/1-1/1-1.2/1-1.2:1.0/0003:04D9:06B.0001/inpuinpute 4.5404651 usb 1-1.2: Manufacturer: HOLTEN 4.643831] hid-gener lc 0003 :04D9 :(19613.0001 : input,hidrtuo0: USB HID u1.10 Keyboard [HOLTEN Wireless USD Deuice] on 04D9: I 4.7271481 input : HOLUM Wireless USB Deuic.e Mouse as /deuices/platform/soc/3f900000.usb/usb1/1-1/1-1.2/1-1.2:1.1/0003:4D9:A068.0002/input/inputi I 4.736202] input: HOME Wireless USD Deuice as /devices/platforn/soc/3f9130000.usb/usb1/1-1/1-1.2/1-1.2:1. I. 4.715148] input: HOLTEN Wireless USB Deuice Couguner Control as /deuices/platforn/soc/3f9B0000.usb/usb1/1-1,1-1.2/1-1.2:1.1/0083:04D9:S0611.0002/inpuvinput3 4.8278241 hid-generic 0003:04D9:A069.000Z: input,hiddeu96 shidraul: USB HID u1.10 House IHOLTEX Wireless USB Deulce] on usb-M900000.usb-1.2,inputl 1.1/0003:009:110611.0.92./ inpu Vinput4 t 4.818346] input.: MOLTEN Wireless USB Deuice System Control as /deuices/platforn/soc4f900000.usb/usb1/1-1/1-1.2/1-1.2:
-
@MartinD Ah sorry, I just realized that you said you see a Linux shell.
Well, it looks like you don't have a window manager running, so you can't use either XCB or Wayland. Those can only be used when you can see the Raspberry Pi OS desktop, for example.
Try
-platform eglfs
-
@MartinD said in Yocto - run QML app on Raspberry Pi 3:
I would like to avoid RPi desktop as I really need fast boot (max 10 sec to my app).
Then you probably want to avoid both X11/XCB and Wayland.
You'll want either eglfs (rendered using the GPU) or linuxfb (rendered using the CPU).
./myapp -platform eglfs
returns
Could not find DRM device!
So you don't have OpenGL ES enabled on your image? Try
-platform linuxfb
then (you'll also need to specify some settings -- see https://doc.qt.io/qt-6/embedded-linux.html#linuxfb ) -
@MartinD said in Yocto - run QML app on Raspberry Pi 3:
-platform linuxfb doesn't work, there is no such platform.
Right, the linuxfb plugin wasn't built.
I have no idea how to add OpenGL ES to my image (it is core-image-base with default configuration using yocto dunfell release).
You'll need to check and customize your Yocto recipes. I don't have experience with custom Yocto images, sorry. Try searching your preferred search engine for "yocto opengl es"
-
@Ronel_qtmaster would you mind sharing how you got it to work?
Im having problems getting eglfs working.
Thanks -
@SuperMonkeyRules yes sure.OKay first of all in your local.conf file add:
DISTRO_FEATURES_remove = "X11 wayland"
DISTRO_FEATURES_append = " opengl"Next go in meta-qt5 folder, recipes-qt and finally qt5
create a file called qtbase_%.bbappendIn that file , write these two lines
PACKAGECONFIG_append = " linuxfb eglfs gbm gles2 kms sql-sqlite"
PACKAGECONFIG_remove = "gl tests examples"finally run bitbake and at the end you will see eglfs in the plugins folder /usr/lib/plugins
Also, i advice you to try first with core-image-sato to launch your app from the board directly but if you feel that your recipe is deploying well it is fine.
Also, i am using dunfell branch.You can add other qt modules in your local.conf by writing
IMAGE_INSTALL_append = " qtbase qtbase-plugins qtserialport qtdeclarative qtquickcontrols qtquickcontrols2 qtvirtualkeyboard qtcharts qt3d qtlocation qtgraphicaleffects qtimageformats qtsensors qtwebsockets qtmqtt qtquick3d qtscxml qtserialbus qtdatavis3d qtknx qtnetworkauth qtsystems qtwebglplugin qtremoteobjects qtmultimedia qtxmlpatterns psplash openssl openssl-bin"
-
@Ronel_qtmaster Thank you.
I will try once I get home. -
@SuperMonkeyRules You're welcome