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.


Log in to reply