Qt World Summit: Submit your Presentation


Could not load the Qt platform plugin "xcb" in "" problem.



  • Hi.
    I'm trying to configure a cross-compilator for Raspberry Pi 4. I made it working once with Qt 5.12.6 but recently I needed to update it to Qt 5.15 so I followed the steps from here: https://github.com/UvinduW/Cross-Compiling-Qt-for-Raspberry-Pi-4.
    When trying to run the example app "qopenglwidget" (step 6), I get error:

    qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
    Failed to move cursor on screen DSI1: -13
    Segmentation fault
    
    

    I tried sudo apt install libxcb-xinerama0, cause it solved the problem for some but it didn't change anything. I already updated Qt from 5.12.6 to 5.15 on another raspberry following the same tutorial and everything is working fine there so no clue why it doesn't work this time.

    Thanks.


  • Moderators

    @Piotrrr
    run ldd on QTDIR/plugins/platforms/libqxcb.so
    and install the packages of all missing dependencies.



  • @Piotrrr
    Try @raven-worx's ldd. If still stuck, export QT_DEBUG_PLUGINS=1 and then run your app for further diagnostic information.



  • Thanks for the reply.
    Output of ldd /usr/local/qt5.15/plugins/platforms/libqxcb.so:

    linux-vdso.so.1 (0xbee48000)
    	/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so (0xb6f99000)
    	libQt5XcbQpa.so.5 => /usr/local/qt5.15/plugins/platforms/../../lib/libQt5XcbQpa.so.5 (0xb6e97000)
    	libfontconfig.so.1 => /usr/lib/arm-linux-gnueabihf/libfontconfig.so.1 (0xb6e2f000)
    	libfreetype.so.6 => /usr/lib/arm-linux-gnueabihf/libfreetype.so.6 (0xb6d8c000)
    	libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0xb6d61000)
    	libQt5Gui.so.5 => /usr/local/qt5.15/plugins/platforms/../../lib/libQt5Gui.so.5 (0xb68bc000)
    	libQt5DBus.so.5 => /usr/local/qt5.15/plugins/platforms/../../lib/libQt5DBus.so.5 (0xb684a000)
    	libQt5Core.so.5 => /usr/local/qt5.15/plugins/platforms/../../lib/libQt5Core.so.5 (0xb640f000)
    	libGLESv2.so.2 => /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2 (0xb63f0000)
    	libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb63c6000)
    	libX11-xcb.so.1 => /usr/lib/arm-linux-gnueabihf/libX11-xcb.so.1 (0xb63b4000)
    	libxcb-icccm.so.4 => /usr/lib/arm-linux-gnueabihf/libxcb-icccm.so.4 (0xb63a0000)
    	libxcb-image.so.0 => /usr/lib/arm-linux-gnueabihf/libxcb-image.so.0 (0xb638c000)
    	libxcb-shm.so.0 => /usr/lib/arm-linux-gnueabihf/libxcb-shm.so.0 (0xb6379000)
    	libxcb-keysyms.so.1 => /usr/lib/arm-linux-gnueabihf/libxcb-keysyms.so.1 (0xb6366000)
    	libxcb-randr.so.0 => /usr/lib/arm-linux-gnueabihf/libxcb-randr.so.0 (0xb6349000)
    	libxcb-render-util.so.0 => /usr/lib/arm-linux-gnueabihf/libxcb-render-util.so.0 (0xb6335000)
    	libxcb-render.so.0 => /usr/lib/arm-linux-gnueabihf/libxcb-render.so.0 (0xb631a000)
    	libxcb-shape.so.0 => /usr/lib/arm-linux-gnueabihf/libxcb-shape.so.0 (0xb6307000)
    	libxcb-sync.so.1 => /usr/lib/arm-linux-gnueabihf/libxcb-sync.so.1 (0xb62f1000)
    	libxcb-xfixes.so.0 => /usr/lib/arm-linux-gnueabihf/libxcb-xfixes.so.0 (0xb62da000)
    	libxcb-xinerama.so.0 => /usr/lib/arm-linux-gnueabihf/libxcb-xinerama.so.0 (0xb62c7000)
    	libxcb-xkb.so.1 => /usr/lib/arm-linux-gnueabihf/libxcb-xkb.so.1 (0xb62a2000)
    	libxcb-xinput.so.0 => not found
    	libxcb.so.1 => /usr/lib/arm-linux-gnueabihf/libxcb.so.1 (0xb6273000)
    	libXext.so.6 => /usr/lib/arm-linux-gnueabihf/libXext.so.6 (0xb6254000)
    	libX11.so.6 => /usr/lib/arm-linux-gnueabihf/libX11.so.6 (0xb6132000)
    	libxkbcommon.so.0 => /usr/lib/arm-linux-gnueabihf/libxkbcommon.so.0 (0xb60e9000)
    	libxkbcommon-x11.so.0 => /usr/lib/arm-linux-gnueabihf/libxkbcommon-x11.so.0 (0xb60d2000)
    	libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb60bf000)
    	libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb5f78000)
    	libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb5ef6000)
    	libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb5ec9000)
    	libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb5d7b000)
    	libxcb-xinput.so.0 => not found
    	libgthread-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgthread-2.0.so.0 (0xb5d69000)
    	libglib-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0 (0xb5c59000)
    	libexpat.so.1 => /lib/arm-linux-gnueabihf/libexpat.so.1 (0xb5c18000)
    	libuuid.so.1 => /lib/arm-linux-gnueabihf/libuuid.so.1 (0xb5c01000)
    	/lib/ld-linux-armhf.so.3 (0xb6fc1000)
    	libpng16.so.16 => /usr/lib/arm-linux-gnueabihf/libpng16.so.16 (0xb5bc5000)
    	libharfbuzz.so.0 => /usr/lib/arm-linux-gnueabihf/libharfbuzz.so.0 (0xb5ac7000)
    	libdbus-1.so.3 => /lib/arm-linux-gnueabihf/libdbus-1.so.3 (0xb5a76000)
    	libdouble-conversion.so.1 => /usr/lib/arm-linux-gnueabihf/libdouble-conversion.so.1 (0xb5a52000)
    	libicui18n.so.63 => /usr/lib/arm-linux-gnueabihf/libicui18n.so.63 (0xb5804000)
    	libicuuc.so.63 => /usr/lib/arm-linux-gnueabihf/libicuuc.so.63 (0xb567e000)
    	libicudata.so.63 => /usr/lib/arm-linux-gnueabihf/libicudata.so.63 (0xb3c80000)
    	libpcre2-16.so.0 => /usr/lib/arm-linux-gnueabihf/libpcre2-16.so.0 (0xb3c04000)
    	libGLdispatch.so.0 => /usr/lib/arm-linux-gnueabihf/libGLdispatch.so.0 (0xb3b85000)
    	libxcb-util.so.0 => /usr/lib/arm-linux-gnueabihf/libxcb-util.so.0 (0xb3b70000)
    	libXau.so.6 => /usr/lib/arm-linux-gnueabihf/libXau.so.6 (0xb3b5d000)
    	libXdmcp.so.6 => /usr/lib/arm-linux-gnueabihf/libXdmcp.so.6 (0xb3b48000)
    	libpcre.so.3 => /lib/arm-linux-gnueabihf/libpcre.so.3 (0xb3ad1000)
    	libgraphite2.so.3 => /usr/lib/arm-linux-gnueabihf/libgraphite2.so.3 (0xb3aa0000)
    	libsystemd.so.0 => /lib/arm-linux-gnueabihf/libsystemd.so.0 (0xb3a03000)
    	libbsd.so.0 => /usr/lib/arm-linux-gnueabihf/libbsd.so.0 (0xb39db000)
    	librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0xb39c4000)
    	liblzma.so.5 => /lib/arm-linux-gnueabihf/liblzma.so.5 (0xb3993000)
    	liblz4.so.1 => /usr/lib/arm-linux-gnueabihf/liblz4.so.1 (0xb3967000)
    	libgcrypt.so.20 => /lib/arm-linux-gnueabihf/libgcrypt.so.20 (0xb388d000)
    	libgpg-error.so.0 => /lib/arm-linux-gnueabihf/libgpg-error.so.0 (0xb3863000)
    

  • Lifetime Qt Champion

    @Piotrrr said in Could not load the Qt platform plugin "xcb" in "" problem.:

    libxcb-xinput.so.0 => not found

    this lib is not there



  • Run the app with export QT_DEBUG_PLUGINS=1 and I got this:

    Got keys from plugin meta data ("xcb")
    QFactoryLoader::QFactoryLoader() checking directory path "/home/pi/platforms" ...
    Cannot load library /usr/local/qt5.15/plugins/platforms/libqxcb.so: (libxcb-xinput.so.0: cannot open shared object file: No such file or directory)
    QLibraryPrivate::loadPlugin failed on "/usr/local/qt5.15/plugins/platforms/libqxcb.so" : "Cannot load library /usr/local/qt5.15/plugins/platforms/libqxcb.so: (libxcb-xinput.so.0: cannot open shared object file: No such file or directory)"
    qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
    

    So it's looking for this file in /home/pi/platforms but that directory doesn't exist, am I right? Where can I get/install this libxcb-xinput.so.0 from?


  • Lifetime Qt Champion

    @Piotrrr said in Could not load the Qt platform plugin "xcb" in "" problem.:

    Where can I get/install this libxcb-xinput.so.0 from?

    What OS is running on your device?
    If Raspbian then it should be libxcb-xinput package.



  • I installed it with apt-get install libxcb-xinput-dev and now the example app works.

    Thanks all for the help.



  • @Piotrrr said in Could not load the Qt platform plugin "xcb" in "" problem.:

    now the example app works

    great, so please don't forget to mark your post as solved!



  • I am facing a similar issue trying to cross-compile QT5.12.3 for the raspberry pi3 using arm-linux-gnueabihf-gcc-8.3.0 on Ubuntu LTS 20.04

    My two centaves coin follows the qt.conf strategy

    • Detect where the crosscompiled X11 backend pluggin is installed on yout target. Following the guides related with, it is usually deployed on /usr/local/qt5pi/plugins or similar
    • Verify the object libqxcb.so is fully resolved on your host, below is my output after installing all dependencies
     # ldd /usr/local/qt5pi/plugins/platforms/libqxcb.so 
     linux-vdso.so.1 (0x7ed50000)
            /usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so (0x76f90000)
            libQt5XcbQpa.so.5 => /usr/local/qt5pi/examples/gui/analogclock/plugins/platforms/../../lib/libQt5XcbQpa.so.5 (0x76e3e000)
            libfontconfig.so.1 => /lib/arm-linux-gnueabihf/libfontconfig.so.1 (0x76dda000)
            libfreetype.so.6 => /lib/arm-linux-gnueabihf/libfreetype.so.6 (0x76d37000)
            libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0x76d0c000)
            libQt5Gui.so.5 => /usr/local/qt5pi/examples/gui/analogclock/plugins/platforms/../../lib/libQt5Gui.so.5 (0x76855000)
            libQt5DBus.so.5 => /usr/local/qt5pi/examples/gui/analogclock/plugins/platforms/../../lib/libQt5DBus.so.5 (0x767c1000)
            libQt5Core.so.5 => /usr/local/qt5pi/examples/gui/analogclock/plugins/platforms/../../lib/libQt5Core.so.5 (0x7632f000)
            libGLESv2.so.2 => /lib/arm-linux-gnueabihf/libGLESv2.so.2 (0x76310000)
            libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0x762e6000)
            libX11-xcb.so.1 => /lib/arm-linux-gnueabihf/libX11-xcb.so.1 (0x762d4000)
            libxcb-icccm.so.4 => /lib/arm-linux-gnueabihf/libxcb-icccm.so.4 (0x762c0000)
            libxcb-image.so.0 => /lib/arm-linux-gnueabihf/libxcb-image.so.0 (0x762ac000)
            libxcb-shm.so.0 => /lib/arm-linux-gnueabihf/libxcb-shm.so.0 (0x76299000)
            libxcb-keysyms.so.1 => /lib/arm-linux-gnueabihf/libxcb-keysyms.so.1 (0x76286000)
            libxcb-randr.so.0 => /lib/arm-linux-gnueabihf/libxcb-randr.so.0 (0x76269000)
            libxcb-render-util.so.0 => /lib/arm-linux-gnueabihf/libxcb-render-util.so.0 (0x76255000)
            libxcb-render.so.0 => /lib/arm-linux-gnueabihf/libxcb-render.so.0 (0x7623a000)
            libxcb-shape.so.0 => /lib/arm-linux-gnueabihf/libxcb-shape.so.0 (0x76227000)
            libxcb-sync.so.1 => /lib/arm-linux-gnueabihf/libxcb-sync.so.1 (0x76211000)
            libxcb-xfixes.so.0 => /lib/arm-linux-gnueabihf/libxcb-xfixes.so.0 (0x761fa000)
            libxcb-xinerama.so.0 => /lib/arm-linux-gnueabihf/libxcb-xinerama.so.0 (0x761e7000)
            libxcb-xkb.so.1 => /lib/arm-linux-gnueabihf/libxcb-xkb.so.1 (0x761c2000)
            libxcb.so.1 => /lib/arm-linux-gnueabihf/libxcb.so.1 (0x76193000)
            libXrender.so.1 => /lib/arm-linux-gnueabihf/libXrender.so.1 (0x7617a000)
            libXext.so.6 => /lib/arm-linux-gnueabihf/libXext.so.6 (0x7615b000)
            libX11.so.6 => /lib/arm-linux-gnueabihf/libX11.so.6 (0x76039000)
            libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x75fb7000)
            libxkbcommon.so.0 => /lib/arm-linux-gnueabihf/libxkbcommon.so.0 (0x75f6e000)
            libxkbcommon-x11.so.0 => /lib/arm-linux-gnueabihf/libxkbcommon-x11.so.0 (0x75f57000)
            libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0x75f44000)
            libstdc++.so.6 => /lib/arm-linux-gnueabihf/libstdc++.so.6 (0x75dfd000)
            libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x75dd0000)
            libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x75c82000)
            libgthread-2.0.so.0 => /lib/arm-linux-gnueabihf/libgthread-2.0.so.0 (0x75c70000)
            libglib-2.0.so.0 => /lib/arm-linux-gnueabihf/libglib-2.0.so.0 (0x75b60000)
            libexpat.so.1 => /lib/arm-linux-gnueabihf/libexpat.so.1 (0x75b1f000)
            libuuid.so.1 => /lib/arm-linux-gnueabihf/libuuid.so.1 (0x75b08000)
            /lib/ld-linux-armhf.so.3 (0x76fb8000)
            libpng16.so.16 => /lib/arm-linux-gnueabihf/libpng16.so.16 (0x75acc000)
            libharfbuzz.so.0 => /lib/arm-linux-gnueabihf/libharfbuzz.so.0 (0x759ce000)
            libdbus-1.so.3 => /lib/arm-linux-gnueabihf/libdbus-1.so.3 (0x7597d000)
            libicui18n.so.63 => /lib/arm-linux-gnueabihf/libicui18n.so.63 (0x7572f000)
            libicuuc.so.63 => /lib/arm-linux-gnueabihf/libicuuc.so.63 (0x755a9000)
            libicudata.so.63 => /lib/arm-linux-gnueabihf/libicudata.so.63 (0x73bab000)
            libpcre2-16.so.0 => /lib/arm-linux-gnueabihf/libpcre2-16.so.0 (0x73b2f000)
            libdouble-conversion.so.1 => /lib/arm-linux-gnueabihf/libdouble-conversion.so.1 (0x73b0b000)
            libGLdispatch.so.0 => /lib/arm-linux-gnueabihf/libGLdispatch.so.0 (0x73a8c000)
            libxcb-util.so.0 => /lib/arm-linux-gnueabihf/libxcb-util.so.0 (0x73a77000)
            libXau.so.6 => /lib/arm-linux-gnueabihf/libXau.so.6 (0x73a64000)
            libXdmcp.so.6 => /lib/arm-linux-gnueabihf/libXdmcp.so.6 (0x73a4f000)
            libpcre.so.3 => /lib/arm-linux-gnueabihf/libpcre.so.3 (0x739d8000)
            libgraphite2.so.3 => /lib/arm-linux-gnueabihf/libgraphite2.so.3 (0x739a7000)
            libsystemd.so.0 => /lib/arm-linux-gnueabihf/libsystemd.so.0 (0x7390a000)
            libbsd.so.0 => /lib/arm-linux-gnueabihf/libbsd.so.0 (0x738e2000)
            librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0x738cb000)
            liblzma.so.5 => /lib/arm-linux-gnueabihf/liblzma.so.5 (0x7389a000)
            liblz4.so.1 => /lib/arm-linux-gnueabihf/liblz4.so.1 (0x7386e000)
            libgcrypt.so.20 => /lib/arm-linux-gnueabihf/libgcrypt.so.20 (0x73794000)
            libgpg-error.so.0 => /lib/arm-linux-gnueabihf/libgpg-error.so.0 (0x7376a000)
    
    • Now the patch can be safetly written.
      On your executable directory write a file qt.conf (which follows a .ini format) where you can specify the specifical QT context required to run your application, on this particular case we only need to adjust the plugins path. A full description can be read here
      i.e .
    pi@raspberrypi:/usr/local/qt5pi/examples/gui/analogclock $ tree
    .
    ├── analogclock
    ├── analogclock.pro
    ├── main.cpp
    ├── plugins -> /usr/local/qt5pi/plugins
    └── qt.conf
    
    1 directory, 4 files
    pi@raspberrypi:/usr/local/qt5pi/examples/gui/analogclock $ cat qt.conf 
    [Paths]
    Plugins=plugins
    

    IHTH

    PD: The qtbase main entry was deployed with the following spec

    $ echo $CROSS_COMPILER_LOCATION
    /home/juanba/raspi/tools/cross-pi-gcc-8.3.0-2
    
    $ ./configure -release -qt-xcb -xcb -opengl es2  -device linux-rasp-pi3-vc4-g++ -device-option CROSS_COMPILE=$(echo $CROSS_COMPILER_LOCATION)/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -prefix /usr/local/qt5pi -extprefix /home/juanba/raspi/qt5pi -opensource -confirm-license -skip qtscript -skip qtwar -v -recheck -L$HOME/raspi//sysroot/usr/lib/arm-linux-gnueabihf -I$HOME/raspi//sysroot/usr/include/arm-linux-gnueabihf
    

Log in to reply