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

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.



  • Hi, everyone!
    I'm using qtcreator as an IDE for GEANT4. I have installed both geant4 and qtcreator. I set environment variables using the following commands:
    jcren@jcren-VirtualBox:~$ source $HOME/G4/install/bin/geant4.sh
    jcren@jcren-VirtualBox:~$ $HOME/../../opt/Qt5.11.1/Tools/QtCreator/bin/qtcreator

    Then I got errors:
    jcren@jcren-VirtualBox:~$ 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 this problem.

    Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

    [1]+ Aborted (core dumped) $HOME/../../opt/Qt5.11.1/Tools/QtCreator/bin/qtcreator

    Then I set debug and got :
    jcren@jcren-VirtualBox:~$ export QT_DEBUG_PLUGINS=1
    jcren@jcren-VirtualBox:~$ $HOME/../../opt/Qt5.11.1/Tools/QtCreator/bin/qtcreator&
    [1] 27660
    jcren@jcren-VirtualBox:~$ QFactoryLoader::QFactoryLoader() checking directory path "/opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms" ...
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqeglfs.so"
    Found metadata in lib /opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqeglfs.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "eglfs"
    ]
    },
    "className": "QEglFSIntegrationPlugin",
    "debug": false,
    "version": 330497
    }

    Got keys from plugin meta data ("eglfs")
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqlinuxfb.so"
    Found metadata in lib /opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqlinuxfb.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "linuxfb"
    ]
    },
    "className": "QLinuxFbIntegrationPlugin",
    "debug": false,
    "version": 330497
    }

    Got keys from plugin meta data ("linuxfb")
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqminimal.so"
    Found metadata in lib /opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqminimal.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "minimal"
    ]
    },
    "className": "QMinimalIntegrationPlugin",
    "debug": false,
    "version": 330497
    }

    Got keys from plugin meta data ("minimal")
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqminimalegl.so"
    Found metadata in lib /opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqminimalegl.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "minimalegl"
    ]
    },
    "className": "QMinimalEglIntegrationPlugin",
    "debug": false,
    "version": 330497
    }

    Got keys from plugin meta data ("minimalegl")
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqoffscreen.so"
    Found metadata in lib /opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqoffscreen.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "offscreen"
    ]
    },
    "className": "QOffscreenIntegrationPlugin",
    "debug": false,
    "version": 330497
    }

    Got keys from plugin meta data ("offscreen")
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqvnc.so"
    Found metadata in lib /opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqvnc.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "vnc"
    ]
    },
    "className": "QVncIntegrationPlugin",
    "debug": false,
    "version": 330497
    }

    Got keys from plugin meta data ("vnc")
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so"
    Found metadata in lib /opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "xcb"
    ]
    },
    "className": "QXcbIntegrationPlugin",
    "debug": false,
    "version": 330497
    }

    Got keys from plugin meta data ("xcb")
    QFactoryLoader::QFactoryLoader() checking directory path "/opt/Qt5.11.1/Tools/QtCreator/bin/platforms" ...
    Cannot load library /opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so: (/usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5: version Qt_5_PRIVATE_API' not found (required by /opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so)) QLibraryPrivate::loadPlugin failed on "/opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so" : "Cannot load library /opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so: (/usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5: versionQt_5_PRIVATE_API' not found (required by /opt/Qt5.11.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so))"
    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 this problem.

    Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

    Can anyone help me solve this problem?
    Thank you and best wishes,
    jcren.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    How exactly did you install Qt ?
    What distribution are you using in your Virtual Box ?
    Can you try with a more recent version of Qt ? The current LTS is 5.12.4 and latest is 5.13.0



  • @SGaist
    Thank you for your reply.
    1、I download the qt-opensource-linux-x64-5.11.1.run from website, then I used the following commands to install it:
    sudo chmod +x qt-opensource-linux-x64-5.11.1.run
    sudo ./qt-opensource-linux-x64-5.11.1.run

    Then I use the default installation folder and select all components.
    After that, I use the following command:
    sudo gedit /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf

    and change the file default.conf to:

    /opt/Qt5.11.1/5.11.1/gcc_64/bin
    /opt/Qt5.11.1/
    #/usr/lib/x86_64-linux-gnu/qt4/bin
    #/usr/lib/x86_64-linux-gnu

    Then I set the environment variables for geant4 by using the following commands:
    source $HOME/G4/install/bin/geant4.sh
    $HOME/../../opt/Qt5.11.1/Tools/QtCreator/bin/qtcreator&

    Here, I met the errors mentioned above.

    2、 I use Ubuntu16.04 in my Oracle VM VirtualBox.

    3、I have tried Qt5.13.0 yesterday twice, and I met the same error as this one.
    The GEANT4 I used is version10.05.p01.
    Best regards,
    jcren.


  • Lifetime Qt Champion

    Never modify your system by hand like that.

    Use qtchooser if you want but use it properly and let it modify your distribution for you as it was designed to.



  • @SGaist
    So how should I do to fix this issue?
    What is qtchooser and how to use it?

    Best regards,
    jcren.



  • Hi,

    I am facing the same issue with Qt 5.15.0 on Ubuntu 16.04 (in a VirtualBox on a Linux host).
    (This is currently still a hard requirement when deploying a Qt application with "linuxdeployqt". Not ideal, because it comes with a lot of restrictions, but I won't write about those now…).

    As a workaround downgrading to 5.14.2 works. Unfortunately this also requires to manually adjust any QML reference from 5.15 -> 5.14. Very annoying.

    However I will post an issue an link it here (if not already done).

    @jcren Sorry I am a bit late on that issue. Don't bother qtchooser. This is a very old tool from the Qt4 era to switch Qt versions. Fiddling with that is a very bad idea and in worst case other installed applications can break by that. Just use the "Qt Maintenance Tool" to manage your Qt development versions (ideally all are located in "$HOME/Qt/<version>/<toolchain>/…"). Further you should definitely learn how to use Linux's "built-in" ldd tool on your application to check on libraries. I mean it! :)

    EDIT: Here we go -> https://bugreports.qt.io/browse/QTBUG-84749



  • Hi, first try (in case you've been bitten by the infamous "ibxcb-xinerama missing" bug):
    sudo apt install libxcb-xinerama0

    If that doesn't help then I think you need to do the chore as in the 1st post above, i.e. in Terminal:

    export QT_DEBUG_PLUGINS=1
    qtcreator
    
    to see where the plugin loading fails...


  • Thanks, I just checked on that! Installing the package didn't help, but the debug output gives:

    Cannot load library /home/ubuntu/Qt/5.15.0/gcc_64/plugins/platforms/libqxcb.so: (libxcb-icccm.so.4: Kann die Shared-Object-Datei nicht öffnen: Datei oder Verzeichnis nicht gefunden)
    QLibraryPrivate::loadPlugin failed on "/home/ubuntu/Qt/5.15.0/gcc_64/plugins/platforms/libqxcb.so" : "Cannot load library /home/ubuntu/Qt/5.15.0/gcc_64/plugins/platforms/libqxcb.so: (libxcb-icccm.so.4…

    (German Version -> says: "file libxcb-icccm.so not found")

    So after installing the following packages it works:

    sudo apt install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0

    Cheers! :)



  • I had a similar issue while installing Meshroom in dev mode. In my case, the problem was a conflict between the QT libraries provided by Anaconda and the system-wide installation.
    Deactivating the offending environment (or creating a clean new one) solved the issue for me.


Log in to reply