在 Linux 上从源代码构建的 Qt5 上找不到 Qt 平台插件 xcb

问题描述 投票:0回答:2

我在 Debian 10 32 位上构建 Qt5。然后我创建了一个最小的 Qt 项目,运行

$ ~/qt/qt-everywhere-src-5.12.7/qtbase/bin/qmake project.pro
make
,但是当我尝试执行该应用程序时,我执行以下操作:

发生什么事了?

$ ./release/project 
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: linuxfb, minimal, offscreen, vnc, webgl.

Aborted

更多信息:

$ QT_DEBUG_PLUGINS=1 release/project 
QFactoryLoader::QFactoryLoader() checking directory path "/home/user/qt/qt-everywhere-src-5.12.7/qtbase/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/home/user/qt/qt-everywhere-src-5.12.7/qtbase/plugins/platforms/libqlinuxfb.so"
Found metadata in lib /home/user/qt/qt-everywhere-src-5.12.7/qtbase/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 "/home/user/qt/qt-everywhere-src-5.12.7/qtbase/plugins/platforms/libqminimal.so"
Found metadata in lib /home/user/qt/qt-everywhere-src-5.12.7/qtbase/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 "/home/user/qt/qt-everywhere-src-5.12.7/qtbase/plugins/platforms/libqoffscreen.so"
Found metadata in lib /home/user/qt/qt-everywhere-src-5.12.7/qtbase/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 "/home/user/qt/qt-everywhere-src-5.12.7/qtbase/plugins/platforms/libqvnc.so"
Found metadata in lib /home/user/qt/qt-everywhere-src-5.12.7/qtbase/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 "/home/user/qt/qt-everywhere-src-5.12.7/qtbase/plugins/platforms/libqwebgl.so"
Found metadata in lib /home/user/qt/qt-everywhere-src-5.12.7/qtbase/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() checking directory path "/home/user/QtProjects/project/release/platforms" ...
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: linuxfb, minimal, offscreen, vnc, webgl.

Aborted
c++ linux qt debian qt5
2个回答
0
投票

libqxcb.so
应位于应用程序的
platforms
子目录中。如果您想更改其搜索位置,请查看 qt.conf ini 文件,该文件控制其他路径中的插件搜索路径


0
投票

我认为您已经编译了没有 xcb 库的 Qt5。所以你在 '/your-qt-path/plugins/platforms/' 中没有 xcb 插件。

正如qt文档所说,建议您先安装此软件包:

libfontconfig1-dev
libfreetype6-dev
libx11-dev
libx11-xcb-dev
libxext-dev
libxfixes-dev
libxi-dev
libxrender-dev
libxcb1-dev
libxcb-cursor-dev
libxcb-glx0-dev
libxcb-keysyms1-dev
libxcb-image0-dev
libxcb-shm0-dev
libxcb-icccm4-dev
libxcb-sync-dev
libxcb-xfixes0-dev
libxcb-shape0-dev
libxcb-randr0-dev
libxcb-render-util0-dev
libxcb-util-dev
libxcb-xinerama0-dev
libxcb-xkb-dev
libxkbcommon-dev
libxkbcommon-x11-dev

之后,删除config.cache,然后重新运行./configure。编译完成后,您应该在“platform”目录中看到“libqxcb.so”文件。

© www.soinside.com 2019 - 2024. All rights reserved.