在ubuntu24中使用qt5.15.2创建窗口程序时出现问题

3 篇文章 0 订阅
2 篇文章 0 订阅

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
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, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

解决过程:

在这里插入图片描述
使用export QT_DEBUG_PLUGINS=1再执行出问题的程序可显示详细报错
输出:

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
QFactoryLoader::QFactoryLoader() checking directory path "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqeglfs.so"
Found metadata in lib /home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqeglfs.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "eglfs"
        ]
    },
    "archreq": 0,
    "className": "QEglFSIntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("eglfs")
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqeglfs.so.debug"
"The shared library was not found." 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqlinuxfb.so"
Found metadata in lib /home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqlinuxfb.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "linuxfb"
        ]
    },
    "archreq": 0,
    "className": "QLinuxFbIntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("linuxfb")
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqlinuxfb.so.debug"
"The shared library was not found." 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqminimal.so"
Found metadata in lib /home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqminimal.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "minimal"
        ]
    },
    "archreq": 0,
    "className": "QMinimalIntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("minimal")
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqminimal.so.debug"
"The shared library was not found." 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqminimalegl.so"
Found metadata in lib /home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqminimalegl.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "minimalegl"
        ]
    },
    "archreq": 0,
    "className": "QMinimalEglIntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("minimalegl")
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqminimalegl.so.debug"
"The shared library was not found." 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqoffscreen.so"
Found metadata in lib /home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqoffscreen.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "offscreen"
        ]
    },
    "archreq": 0,
    "className": "QOffscreenIntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("offscreen")
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqoffscreen.so.debug"
"The shared library was not found." 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqvnc.so"
Found metadata in lib /home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqvnc.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "vnc"
        ]
    },
    "archreq": 0,
    "className": "QVncIntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("vnc")
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqvnc.so.debug"
"The shared library was not found." 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-egl.so"
Found metadata in lib /home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-egl.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "wayland-egl"
        ]
    },
    "archreq": 0,
    "className": "QWaylandEglPlatformIntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("wayland-egl")
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-egl.so.debug"
"The shared library was not found." 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-generic.so"
Found metadata in lib /home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-generic.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "wayland"
        ]
    },
    "archreq": 0,
    "className": "QWaylandIntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("wayland")
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-generic.so.debug"
"The shared library was not found." 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-xcomposite-egl.so"
Found metadata in lib /home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-xcomposite-egl.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "wayland-xcomposite-egl"
        ]
    },
    "archreq": 0,
    "className": "QWaylandXCompositeEglPlatformIntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("wayland-xcomposite-egl")
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-xcomposite-egl.so.debug"
"The shared library was not found." 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-xcomposite-glx.so"
Found metadata in lib /home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-xcomposite-glx.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "wayland-xcomposite-glx"
        ]
    },
    "archreq": 0,
    "className": "QWaylandXCompositeGlxPlatformIntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("wayland-xcomposite-glx")
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqwayland-xcomposite-glx.so.debug"
"The shared library was not found." 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqwebgl.so.debug"
"The shared library was not found." 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqxcb.so"
Found metadata in lib /home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqxcb.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "xcb"
        ]
    },
    "archreq": 0,
    "className": "QXcbIntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() looking at "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqxcb.so.debug"
"The shared library was not found." 
         not a plugin
QFactoryLoader::QFactoryLoader() checking directory path "/home/hwei/WorkSpace/codeSpace/Qt/test/CV_Test/build/Desktop_Qt_5_15_2_GCC_64bit-Debug/platforms" ...
Cannot load library /home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqxcb.so: (libxcb-xinerama.so.0: cannot open shared object file: No such file or directory)
QLibraryPrivate::loadPlugin failed on "/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqxcb.so" : "Cannot load library /home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqxcb.so: (libxcb-xinerama.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.
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, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

zsh: IOT instruction (core dumped)  ./CV_Test

输出中有这样一句

QLibraryPrivate::loadPlugin failed on “/home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqxcb.so” : “Cannot load library /home/hwei/Public/Qt/5.15.2/gcc_64/plugins/platforms/libqxcb.so: (libxcb-xinerama.so.0: cannot open shared object file: No such file or directory)”
可以清楚的看到这个库找不到,那就安装它

解决:

sudo apt install libxcb-xinerama0

上个问题解决后,还遗留下以下这个问题虽然不影响执行,但是影响观感,有大佬看到可以帮我解决下

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFoRM=wayland to run on Wayland anyway.
MESA: error: ZINK:failed to choose pdev
glx: failed to create drisw screen

参考

qt.qpa.plugin: Could not load the Qt platform plugin “xcb“ in问题

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值