服务器之家:专注于服务器技术及软件下载分享
分类导航

Linux|Centos|Ubuntu|系统进程|Fedora|注册表|Bios|Solaris|Windows7|Windows10|

服务器之家 - 服务器系统 - Ubuntu - Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题

Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题

2020-08-19 18:08盼小辉丶 Ubuntu

这篇文章主要介绍了Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题,本文给大家分享解决方案,需要的朋友可以参考下

问题描述

安装Qt5.15.0后,在运行测试用例时弹出错误:

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.

Aborted (core dumped)

根据问题描述,虽然能够找到但是不能加载Qt平台插件“xcb”,虽然接下来又说重新安装可能能够解决,这个可能的话,还是尽量作为最下的选择吧。

定位问题

修改配置文件~/.bashrc:

?
1
$ vim ~/.bashrc

在最末尾添加如下语句,会在qtcreator启动时,列出详细的错误提示。

?
1
export QT_DEBUG_PLUGINS=1

如下:

Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题

保存退出编辑,使配置文件生效:

?
1
$ source ~/.bashrc

启动qtcreator会弹出如下详细错误信息:

Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题

在打印的错误信息的最下面,找到了引发错误的真正原因:

Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题

也就是Qt动态链接库的问题,当加载libqxcb.so库的时候,还需要加载libxcb-xinerama库。
切换到报错libxcb.so所在目录:

?
1
2
#替换为自己的报错目录
$ cd /home/brainiac/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/

运行ldd libqxcb.so,查看关联内容:

?
1
$ ldd libqxcb.so

Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题

发现不存在libxcb-xinerama.so.0库。

解决方法

安装libxcb-xinerama库:

?
1
2
#如果还存在其他依赖库没有安装,也一并安装。
$ sudo apt-get install libxcb-xinerama0

安装完成后,再次查看关联内容,发现已经修复问题:

?
1
$ ldd libqxcb.so

Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题

再次运行qt程序,就可以正常运行了。

Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题

后记

又可以愉快的coding了。

总结

到此这篇关于Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题的文章就介绍到这了,更多相关Ubuntu18.04解决Qt出现qt.qpa.plugin内容请搜索服务器之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持服务器之家!

原文链接:https://blog.csdn.net/LOVEmy134611/article/details/107212845

延伸 · 阅读

精彩推荐
  • Ubuntuubuntu系统中删除/卸载自行安装的字体的方法

    ubuntu系统中删除/卸载自行安装的字体的方法

    ubuntu系统不同于windows系统,windows字体我们都会删除,下面分享删除ubuntu系统中我们自己安装的自己的方法,需要的朋友可以参考下 ...

    ubuntu教程网3202019-10-27
  • Ubuntu在Ubuntu中怎么安装JDK图文解析

    在Ubuntu中怎么安装JDK图文解析

    在 Ubuntu 中怎么安装 JDK 图文解析,对于很多不知道怎么操作的朋友可以参考本文,希望能给大家带来帮助! 方法/步骤 1,到Oracle官网下载相关的JDK 2,假设...

    服务器之家3882019-07-09
  • UbuntuUbuntu20.04防火墙设置简易教程(小白)

    Ubuntu20.04防火墙设置简易教程(小白)

    这篇文章主要介绍了Ubuntu20.04防火墙设置简易教程(小白),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友...

    夜月枫雪4092020-08-01
  • UbuntuUbuntu下如何编辑开始菜单?Ubuntu下编辑开始菜单的方法

    Ubuntu下如何编辑开始菜单?Ubuntu下编辑开始菜单的方法

    最近一些朋友问小编Ubuntu下如何编辑开始菜单?今天小编就为大家分享Ubuntu下编辑开始菜单的方法!希望能够帮助到大家!有需要的朋友一起去看看吧...

    服务器之家5972019-06-01
  • Ubuntuubuntu下网页打开慢的解决方法

    ubuntu下网页打开慢的解决方法

    昨天心血来潮装上了ubuntu10.04 很有纪念意义的一个版本。毕竟版本号跟我的生日是在同一天哈~嘿嘿。 ...

    Ubuntu教程网5782019-11-27
  • UbuntuUbuntu下开启vnc的tip方法

    Ubuntu下开启vnc的tip方法

    这篇文章主要介绍了Ubuntu下开启vnc的tip方法,本文直接给出操作步骤和操作方法,需要的朋友可以参考下 ...

    服务器之家2342019-10-13
  • UbuntuUbuntu系统中怎么卸载Sublime Text3?

    Ubuntu系统中怎么卸载Sublime Text3?

    Ubuntu系统中怎么卸载Sublime Text3?Ubuntu系统中安装了Sublime Text3汉化后的软件,该怎么才能干净的卸载呢?下面我们就来看看详细的教程,需要的朋友可以参...

    Ubuntu之家4792019-06-27
  • Ubuntuubuntu15.04怎么给deepin音乐播放器添加插件?

    ubuntu15.04怎么给deepin音乐播放器添加插件?

    deepin音乐播放器是一款外观较为漂亮的播放软件了。虽然比不上windows下的那些华丽的播放器。但从实用性出发已经够了。它可以播放本地的音乐,当然,也...

    百度经验3082019-10-12