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:

$ vim ~/.bashrc

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

export QT_DEBUG_PLUGINS=1

如下:

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

$ source ~/.bashrc

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

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

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

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

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

$ ldd libqxcb.so


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

解决方法

安装libxcb-xinerama库:

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

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

$ ldd libqxcb.so


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

后记

又可以愉快的coding了。

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

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

    1.问题描述 在ubuntu18.04中第一次安装QT5,运行时报错 qtcreator.sh qt.qpa.plugin: Could not load the Qt platform plugin ...

  2. 出现“qt.qpa.plugin: Could not load the Qt platform plugin “xcb“ in ‘ ’even though it was found

    出现"qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in ' 'even though it wa ...

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

    问题描述 python调用matplotlib.pyplot库进行图形绘制时弹出错误提示: qt.qpa.plugin: Could not load the Qt platform plugin & ...

  4. Ubuntu16.04下Python程序出现错误qt.qpa.plugin: Could not load the Qt platform plugin xcb解决方法

    问题描述 我在运行一个使用Pyqt5库的Python程序时,出现报错: qt.qpa.plugin: Could not load the Qt platform plugin "xcb&q ...

  5. uBuntu20.04安装Qt5.15.2出现qt.qpa.plugin: Could not load the Qt platform plugin “xcb“的问题解决

    由于Qt6.22太新,我不得不重新安装了Qt,同时安装了Qt6.22和Qt5.15.2,安装完毕后使用Qt6.22是没有问题的,但使用Qt5.15.2运行程序时,提示如下错误 qt.qpa.plugi ...

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

    项目场景: 在使用pyqt5出现问题,让人真的很头疼哇 问题描述 具体问题如下: qt.qpa.plugin: Could not load the Qt platform plugin " ...

  7. 解决Ubuntu系统安装QT出错的问题:qt.qpa.plugin: Could not load the Qt platform plugin “xcb“ in ““ even though it

    最近新入手的笔记本无法安装Ubuntu系统,无奈只能通过VirtualBox安装Ubuntu16.04,但是发现安装最新版本的QT5.12.10时候无法启动QtCreator程序,通过命令行运行发现如 ...

  8. 【已解决】报错qt.qpa.plugin: Could not load the Qt platform plugin “windows“ in “...“ even though it was

    问题描述: 在Python程序中使用到Pyside2进行图形界面搭建,并使用Pyinstaller将程序打包为独立可执行文件后,双击.exe文件,出现报错: "qt.qpa.plugin: ...

  9. Ubuntu18.04下无法进入图形界面、无法调整分辨率、无法重装显卡驱动问题的解决方式

    Ubuntu18.04下无法进入图形界面.无法调整分辨率.无法重装显卡驱动问题的解决方式 参考文章: (1)Ubuntu18.04下无法进入图形界面.无法调整分辨率.无法重装显卡驱动问题的解决方式 ( ...

最新文章

  1. vuejs基础玩法(基础知识,不喜勿喷!)
  2. python读取csv文件的方法-python读取csv文件指定行的2种方法详解
  3. golang实现生产者和消费者
  4. mysql报表占容量_MariaDB(MySQL)修改表结构报表空间满
  5. android 桌面视频播放器,ZY-Player ,一款跨平台桌面端视频资源播放器
  6. 程序员降薪求职到底该不该?
  7. Android Studio开发实战(新手入门)一
  8. vue3中的beforeEach里面的next函数---刷新页面导致白页
  9. java不同数据类型混合运算规则
  10. 安装Mediapipe中遇到的问题ERROR: An error occurred during the fetch of repository ‘local_execution_config_pyt
  11. 漫漫Java学习路,第十四天
  12. 第2章 构建自定义语料库
  13. Python实现将一张图片切成9宫格
  14. 栈的push、pop序列-判断序列是否是栈的pop顺序
  15. 如何验证Java 布尔类型的true = 1 ,false = 0
  16. 使用计算机的快捷键有哪些,电脑操作的快捷键有哪些,都是什么作用?
  17. css 调用外部字体、自定义字体
  18. Python 向人工智能方向发展的技能树
  19. python requests的作用_requests session的作用
  20. 考研数学张宇:7月复习规划

热门文章

  1. 跟锦数学2017年01月
  2. ASP.NET MVC Html.BeginForm用法1
  3. 修车-最小费用最大流
  4. centos 6.2 syslog-ng的配置
  5. 转载:认识自我,把握机遇 —— 谢恩伟 (二)
  6. [转载] python解析返回结果_python:解析requests返回的response(json格式)说明
  7. [转载] Python字符串解析
  8. GPS NMEA0183协议解析(转载)
  9. 『计算机视觉』Mask-RCNN_推断网络终篇:使用detect方法进行推断
  10. .net core部署到Ubuntu碰到的问题