Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Why Qt platform plugin “xcb” cannot be loaded even though it was found?



  • I cross-compiled Qt5.12 in my laptop and installed it on a Raspberry Pi 3 that runs Raspbian Stretch OS. I'm trying to remote debug (from QtCreator) applications running on RPi.

    When I run my Qt apps from RPi terminal with a command like ./app -platform xcb it works fine, but when I try to run the same app from a remote debug session I get the following output:

    Could not load shared library symbols for /usr/local/qt5pi/plugins/platforms/libqxcb.so.
    Do you need "set solib-search-path" or "set sysroot"?qt.qpa.xcb: could not connect to display 
    qt.qpa.xcb: could not connect to display 
    qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/qt5pi/plugins/platforms" even though it was found.
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    
    Available platform plugins are: 
    eglfs (from /usr/local/qt5pi/plugins/platforms), 
    linuxfb (from /usr/local/qt5pi/plugins/platforms), 
    minimal (from /usr/local/qt5pi/plugins/platforms), 
    minimalegl (from /usr/local/qt5pi/plugins/platforms), 
    offscreen (from /usr/local/qt5pi/plugins/platforms), 
    vnc (from /usr/local/qt5pi/plugins/platforms), 
    webgl (from /usr/local/qt5pi/plugins/platforms), 
    xcb (from /usr/local/qt5pi/plugins/platforms), 
    eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, webgl, xcb.
    

    Has anyone ever experienced this? What could I try to fix that?


  • Qt Champions 2020

    @rrd0 said in Why Qt plaftorm plugin “xcb” cannot be loaded even though it was found?:

    /usr/local/qt5pi/plugins/platforms/libqxcb.so

    ldd /usr/local/qt5pi/plugins/platforms/libqxcb.so



  • $ ldd /usr/local/qt5pi/plugins/platforms/libqxcb.so 
    	linux-vdso.so.1 (0x7ed71000)
    	/usr/lib/arm-linux-gnueabihf/libarmmem.so (0x76fb7000)
    	libQt5XcbQpa.so.5 => /usr/local/qt5pi/plugins/platforms/../../lib/libQt5XcbQpa.so.5 (0x76e22000)
    	libfontconfig.so.1 => /usr/lib/arm-linux-gnueabihf/libfontconfig.so.1 (0x76dc7000)
    	libfreetype.so.6 => /usr/lib/arm-linux-gnueabihf/libfreetype.so.6 (0x76d2c000)
    	libQt5Gui.so.5 => /usr/local/qt5pi/plugins/platforms/../../lib/libQt5Gui.so.5 (0x76846000)
    	libQt5DBus.so.5 => /usr/local/qt5pi/plugins/platforms/../../lib/libQt5DBus.so.5 (0x767c5000)
    	libQt5Core.so.5 => /usr/local/qt5pi/plugins/platforms/../../lib/libQt5Core.so.5 (0x76254000)
    	libGLESv2.so => /opt/vc/lib/libGLESv2.so (0x7622f000)
    	libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0x76206000)
    	libX11.so.6 => /usr/lib/arm-linux-gnueabihf/libX11.so.6 (0x760e3000)
    	libX11-xcb.so.1 => /usr/lib/arm-linux-gnueabihf/libX11-xcb.so.1 (0x760d1000)
    	libXrender.so.1 => /usr/lib/arm-linux-gnueabihf/libXrender.so.1 (0x760b8000)
    	libxcb.so.1 => /usr/lib/arm-linux-gnueabihf/libxcb.so.1 (0x76089000)
    	libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0x76076000)
    	libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0x75f2e000)
    	libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x75eaf000)
    	libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x75e82000)
    	libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x75d43000)
    	libgthread-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgthread-2.0.so.0 (0x75d31000)
    	libglib-2.0.so.0 => /lib/arm-linux-gnueabihf/libglib-2.0.so.0 (0x75c29000)
    	libexpat.so.1 => /lib/arm-linux-gnueabihf/libexpat.so.1 (0x75bf5000)
    	/lib/ld-linux-armhf.so.3 (0x76fcd000)
    	libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0x75bce000)
    	libpng16.so.16 => /usr/lib/arm-linux-gnueabihf/libpng16.so.16 (0x75b94000)
    	libdbus-1.so.3 => /lib/arm-linux-gnueabihf/libdbus-1.so.3 (0x75b41000)
    	libdouble-conversion.so.1 => /usr/lib/arm-linux-gnueabihf/libdouble-conversion.so.1 (0x75b1f000)
    	libEGL.so => /opt/vc/lib/libEGL.so (0x75ae6000)
    	libbcm_host.so => /opt/vc/lib/libbcm_host.so (0x75abf000)
    	libvchiq_arm.so => /opt/vc/lib/libvchiq_arm.so (0x75aa9000)
    	libvcos.so => /opt/vc/lib/libvcos.so (0x75a90000)
    	librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0x75a79000)
    	libXau.so.6 => /usr/lib/arm-linux-gnueabihf/libXau.so.6 (0x75a6c000)
    	libXdmcp.so.6 => /usr/lib/arm-linux-gnueabihf/libXdmcp.so.6 (0x75a57000)
    	libpcre.so.3 => /lib/arm-linux-gnueabihf/libpcre.so.3 (0x759de000)
    	libsystemd.so.0 => /lib/arm-linux-gnueabihf/libsystemd.so.0 (0x75964000)
    	libbsd.so.0 => /lib/arm-linux-gnueabihf/libbsd.so.0 (0x7593b000)
    	libselinux.so.1 => /lib/arm-linux-gnueabihf/libselinux.so.1 (0x75908000)
    	liblzma.so.5 => /lib/arm-linux-gnueabihf/liblzma.so.5 (0x758d7000)
    	liblz4.so.1 => /usr/lib/arm-linux-gnueabihf/liblz4.so.1 (0x758b6000)
    	libgcrypt.so.20 => /lib/arm-linux-gnueabihf/libgcrypt.so.20 (0x757e5000)
    	libgpg-error.so.0 => /lib/arm-linux-gnueabihf/libgpg-error.so.0 (0x757c3000)
    

    Is something wrong?


  • Lifetime Qt Champion

    Hi,

    Not seeing anything obvious right now.

    One thing you can do is start your application with the "QT_DEBUG_PLUGINS" environment variable set to 1 and you'll get information about what is going on with the plugins.



  • @SGaist

    Here's the whole output with QT_DEBUG_PLUGINS=1:

    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/qt5pi/plugins/platforms" ...
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqeglfs.so"
    Found metadata in lib /usr/local/qt5pi/plugins/platforms/libqeglfs.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "eglfs"
            ]
        },
        "archreq": 0,
        "className": "QEglFSIntegrationPlugin",
        "debug": false,
        "version": 330752
    }
    
    
    Got keys from plugin meta data ("eglfs")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqlinuxfb.so"
    Found metadata in lib /usr/local/qt5pi/plugins/platforms/libqlinuxfb.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "linuxfb"
            ]
        },
        "archreq": 0,
        "className": "QLinuxFbIntegrationPlugin",
        "debug": false,
        "version": 330752
    }
    
    
    Got keys from plugin meta data ("linuxfb")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqminimal.so"
    Found metadata in lib /usr/local/qt5pi/plugins/platforms/libqminimal.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "minimal"
            ]
        },
        "archreq": 0,
        "className": "QMinimalIntegrationPlugin",
        "debug": false,
        "version": 330752
    }
    
    
    Got keys from plugin meta data ("minimal")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqminimalegl.so"
    Found metadata in lib /usr/local/qt5pi/plugins/platforms/libqminimalegl.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "minimalegl"
            ]
        },
        "archreq": 0,
        "className": "QMinimalEglIntegrationPlugin",
        "debug": false,
        "version": 330752
    }
    
    
    Got keys from plugin meta data ("minimalegl")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqoffscreen.so"
    Found metadata in lib /usr/local/qt5pi/plugins/platforms/libqoffscreen.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "offscreen"
            ]
        },
        "archreq": 0,
        "className": "QOffscreenIntegrationPlugin",
        "debug": false,
        "version": 330752
    }
    
    
    Got keys from plugin meta data ("offscreen")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqvnc.so"
    Found metadata in lib /usr/local/qt5pi/plugins/platforms/libqvnc.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "vnc"
            ]
        },
        "archreq": 0,
        "className": "QVncIntegrationPlugin",
        "debug": false,
        "version": 330752
    }
    
    
    Got keys from plugin meta data ("vnc")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqwebgl.so"
    Found metadata in lib /usr/local/qt5pi/plugins/platforms/libqwebgl.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "webgl"
            ]
        },
        "archreq": 0,
        "className": "QWebGLIntegrationPlugin",
        "debug": false,
        "version": 330752
    }
    
    
    Got keys from plugin meta data ("webgl")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqxcb.so"
    Found metadata in lib /usr/local/qt5pi/plugins/platforms/libqxcb.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "xcb"
            ]
        },
        "archreq": 0,
        "className": "QXcbIntegrationPlugin",
        "debug": false,
        "version": 330752
    }
    
    
    Got keys from plugin meta data ("xcb")
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/qt5pi/plugins" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/home/user/app-directory" ...
    QFactoryLoader::QFactoryLoader() looking at "/home/user/app-directory/app"
    "Failed to extract plugin meta data from '/home/user/app-directory/app'" 
             not a plugin
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/qt5pi/plugins/platforms/platforms" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/qt5pi/plugins/platforms" ...
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqeglfs.so"
    Got keys from plugin meta data ("eglfs")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqlinuxfb.so"
    Got keys from plugin meta data ("linuxfb")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqminimal.so"
    Got keys from plugin meta data ("minimal")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqminimalegl.so"
    Got keys from plugin meta data ("minimalegl")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqoffscreen.so"
    Got keys from plugin meta data ("offscreen")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqvnc.so"
    Got keys from plugin meta data ("vnc")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqwebgl.so"
    Got keys from plugin meta data ("webgl")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqxcb.so"
    Got keys from plugin meta data ("xcb")
    QFactoryLoader::QFactoryLoader() checking directory path "/home/user/app-directory/platforms" ...
    Could not load shared library symbols for /usr/local/qt5pi/plugins/platforms/libqxcb.so.
    Do you need "set solib-search-path" or "set sysroot"?loaded library "/usr/local/qt5pi/plugins/platforms/libqxcb.so"
    qt.qpa.xcb: could not connect to display 
    qt.qpa.xcb: could not connect to display 
    qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/qt5pi/plugins/platforms" even though it was found.
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    
    Available platform plugins are: eglfs (from /usr/local/qt5pi/plugins/platforms), linuxfb (from /usr/local/qt5pi/plugins/platforms), minimal (from /usr/local/qt5pi/plugins/platforms), minimalegl (from /usr/local/qt5pi/plugins/platforms), offscreen (from /usr/local/qt5pi/plugins/platforms), vnc (from /usr/local/qt5pi/plugins/platforms), webgl (from /usr/local/qt5pi/plugins/platforms), xcb (from /usr/local/qt5pi/plugins/platforms), eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, webgl, xcb.
    

    TL;DR:

    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqxcb.so"
    Found metadata in lib /usr/local/qt5pi/plugins/platforms/libqxcb.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "xcb"
            ]
        },
        "archreq": 0,
        "className": "QXcbIntegrationPlugin",
        "debug": false,
        "version": 330752
    }
    
    
    Got keys from plugin meta data ("xcb")
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/qt5pi/plugins" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/home/user/app-directory" ...
    QFactoryLoader::QFactoryLoader() looking at "/home/user/app-directory/app"
    "Failed to extract plugin meta data from '/home/user/app-directory/app'" 
             not a plugin
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/qt5pi/plugins/platforms/platforms" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/qt5pi/plugins/platforms" ...
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqeglfs.so"
    Got keys from plugin meta data ("eglfs")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqlinuxfb.so"
    Got keys from plugin meta data ("linuxfb")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqminimal.so"
    Got keys from plugin meta data ("minimal")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqminimalegl.so"
    Got keys from plugin meta data ("minimalegl")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqoffscreen.so"
    Got keys from plugin meta data ("offscreen")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqvnc.so"
    Got keys from plugin meta data ("vnc")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqwebgl.so"
    Got keys from plugin meta data ("webgl")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5pi/plugins/platforms/libqxcb.so"
    Got keys from plugin meta data ("xcb")
    QFactoryLoader::QFactoryLoader() checking directory path "/home/user/app-directory/platforms" ...
    Could not load shared library symbols for /usr/local/qt5pi/plugins/platforms/libqxcb.so.
    Do you need "set solib-search-path" or "set sysroot"?loaded library "/usr/local/qt5pi/plugins/platforms/libqxcb.so"
    qt.qpa.xcb: could not connect to display 
    qt.qpa.xcb: could not connect to display 
    qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/qt5pi/plugins/platforms" even though it was found.
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    
    Available platform plugins are: eglfs (from /usr/local/qt5pi/plugins/platforms), linuxfb (from /usr/local/qt5pi/plugins/platforms), minimal (from /usr/local/qt5pi/plugins/platforms), minimalegl (from /usr/local/qt5pi/plugins/platforms), offscreen (from /usr/local/qt5pi/plugins/platforms), vnc (from /usr/local/qt5pi/plugins/platforms), webgl (from /usr/local/qt5pi/plugins/platforms), xcb (from /usr/local/qt5pi/plugins/platforms), eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, webgl, xcb.
    


  • @rrd0 from your error log please see entries like this

    qt.qpa.xcb: could not connect to display

    that coupled with the way you said you're starting your app

    when I try to run the same app from a remote debug session

    seems to me that you're not using a SSH session with X Forwarding... don't forget the -X parameter along with proper hosts authorization

    ssh -X user@hostname
    


  • @Pablo-J.-Rogina

    I'm not using X forwarding. The app is displayed on the target. Just text (stdout and stderr, I guess) is displayed on my dev machine.


  • Lifetime Qt Champion

    You still have to configure things properly. You are starting your application remotely, so you have to configure your session so that your application tries to connect to the local X server.



  • @SGaist

    QtCreator has a tab to set Host, SHH port, username, key file, etc. But there's no box where I could enter that -X option.

    Could you give me some pointers?



  • This post is deleted!

  • Lifetime Qt Champion

    I may be wrong but I don't think you currently can.

    Out of curiosity, what is the reason for having a full X server running on your embedded target ?



  • Hi, I also run Qt apps on my Raspberry Pi, and when I had problems using the -platform xcb to connect to them, I instead use -platform vnc works fine.
    (On my PC I use vncviewer.exe to connect)



  • @SGaist

    I'm using X cause I tried (a lot) to run my apps on EGLFS with no success. I followed the RaspberryPi2EGLFS guide, from qt wiki, to build Qt for RPi, but never managed to make it work.

    Do you know some other guide that could help me build Qt (EGLFS) for RPi?

    P.S. Someone updated the RaspberryPi2EGLFS guide, so I'll give it a last try.



  • @hskoglund

    I'll try that. Thanks!


  • Lifetime Qt Champion

    Any chance you are having trouble using a Raspbian Stretch root filesystem ?



  • @SGaist

    What kind of trouble?


  • Lifetime Qt Champion

    The EGLFS issue.



  • @SGaist

    Raspbian Stretch is the distribution used in RaspberryPi2EGLFS guide, and I followed each one of the steps described in that guide. So, I don't think there's something wrong with my root filesystem.


Log in to reply