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

博客内容描述了在运行Qt Creator时遇到的QPlatformPlugin "xcb"加载失败的问题,原因是Qt版本冲突导致的库加载错误。解决方法是通过设置环境变量QT_DEBUG_PLUGINS找出具体错误,然后将Qt安装目录下的libQt5XcbQpa.so.5库文件复制到系统库路径下覆盖原有文件。问题起因于系统中既有Qt5.9.2又有Qt5.12.12,导致库冲突。
摘要由CSDN通过智能技术生成

报错内容:

~/Qt5.12.12/Tools/QtCreator/bin$ ./qtcreator
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.

已放弃 (核心已转储)

解决方法:

发现是Qt加载插件出现问题,通过设置QT_DEBUG_PLUGINS=1,可以查看Qt的插件加载信息。
所以先设置环境变量:

export QT_DEBUG_PLUGINS=1

再次运行程序时,会打印出很多信息,重点是最后一段:


Cannot load library /home/imu/Qt5.12.12/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so: (libQt5XcbQpa.so.5: version `Qt_5_PRIVATE_API' not found (required by /home/imu/Qt5.12.12/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so))
QLibraryPrivate::loadPlugin failed on "/home/imu/Qt5.12.12/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so" : "Cannot load library /home/imu/Qt5.12.12/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 /home/imu/Qt5.12.12/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.

已放弃 (核心已转储)


在目录/Qt5.12.12/5.12.12/gcc_64/lib找到对应的文件libQt5XcbQpa.so.5

复制到目录/计算机/usr/lib/x86_64-linux-gnu覆盖掉原有重名文件

此过程可以使用 sudo nautilus 进入ubuntu 文件管理器,随意复制,删除,粘贴,无权限限制

问题原因:

qt冲突,因为系统本身有一个qt5.9.2版本,而又装了qt5.12.12,因此打包之后会有库冲突,所以根据提示错误,在系统里搜索对应的库,在qt安装目录的库,对应复制到程序lib文件夹下即可。

参考链接:

https://www.jb51.net/article/193024.htm

PyQt5:解决qt.qpa.plugin: Could not load the Qt platform plugin "xcb"错误 - 简书

libqxcb.so错误解决 - 简书

Error on execution -version `Qt_5' not found required by_Chasing Freedom-CSDN博客



 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值