ubuntu安装qt5 Could not load the Qt platform plugin “xcb“ in ““ even though it was found.

2023-10-08 03:30

本文主要是介绍ubuntu安装qt5 Could not load the Qt platform plugin “xcb“ in ““ even though it was found.,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

每次在linux安装QT总是会出现各种问题,看了很多博客都不够全面,解决问题花了很大的精力,实属没必要。想写篇尽可能全面的博客记录下来。

QT版本:qt-opensource-linux-x64-5.12.10.run
ubantu版本:18.04桌面版

1、下载

下载地址:https://download.qt.io/archive/qt/5.12/在这里插入图片描述

2、运行安装文件

注意:安装要在系统提供的终端上进行,xshell下无法安装成功

给qt-opensource-linux-x64-5.12.10.run执行权限

chmod +x qt-opensource-linux-x64-5.12.10.run

执行完毕后用ls命令查看qt-opensource-linux-x64-5.12.10.run,确认有执行权限

ls -l qt-opensource-linux-x64-5.12.10.run

此时权限如下所示
在这里插入图片描述

3、开始安装

为了跳过QT安装时的登陆账号步骤,安装之前先把网络断开,如果有账号可以不断网。
执行如下命令启动安装程序,安装过程不要关闭终端窗口

 ./qt-opensource-linux-x64-5.12.10.run

在这里插入图片描述
一路下一步,直到选择组件时,最好全选,否则根据用途自行选择
在这里插入图片描述

想了解各模块功能的同学,参看如下链接:
Qt Charts:https://blog.csdn.net/u011430225/article/details/79012904
Qt Data Visualization:同上
Qt Purchasing :https://www.cnblogs.com/findumars/p/5574539.html
Virtual Keyboard:同上

安装完成后,就下而已在如下目录中找到QTCreator了(如果不是安装在home根目录,需要进入指定目录)

~/Qt5.12.10/Tools/QtCreator/bin$

在这里插入图片描述

4、安装完毕

此时,qt已经安装完毕,尝试启动qtcreator,在ubantu下时无法启动,出现如下问题

找不到xcb库

This application failed to start because it could not find or load the Qt platform plugin "xcb"
in "".Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.Reinstalling the application may fix this problem.
Aborted (core dumped)

解决方法:

解决方法:
1.sudo gedit ~/.bashrc 输入 export QT_DEBUG_PLUGINS=1 和
export LD_LIBRARY_PATH=/home/itcast/qt/Qt5.12.10/5.12.10/gcc_64/lib:$LD_LIBRARY_PATH(注意把路径替换为自己的安装路径)

2.运行qtcreator,在命令行得到运行中过程,如下

QFactoryLoader::QFactoryLoader() checking directory path "/home/itcast/qt/Qt5.12.10/Tools/QtCreator/lib/Qt/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/home/itcast/qt/Qt5.12.10/Tools/QtCreator/lib/Qt/plugins/platforms/libqeglfs.so"
Found metadata in lib /home/itcast/qt/Qt5.12.10/Tools/QtCreator/lib/Qt/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/itcast/qt/Qt5.12.10/Tools/QtCreator/lib/Qt/plugins/platforms/libqlinuxfb.so"
Found metadata in lib /home/itcast/qt/Qt5.12.10/Tools/QtCreator/lib/Qt/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/itcast/qt/Qt5.12.10/Tools/QtCreator/lib/Qt/plugins/platforms/libqminimal.so"
Found metadata in lib /home/itcast/qt/Qt5.12.10/Tools/QtCreator/lib/Qt/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/itcast/qt/Qt5.12.10/Tools/QtCreator/lib/Qt/plugins/platforms/libqminimalegl.so"
Found metadata in lib /home/itcast/qt/Qt5.12.10/Tools/QtCreator/lib/Qt/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/itcast/qt/Qt5.12.10/Tools/QtCreator/lib/Qt/plugins/platforms/libqoffscreen.so"
Found metadata in lib /home/itcast/qt/Qt5.12.10/Tools/QtCreator/lib/Qt/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/itcast/qt/Qt5.12.10/Tools/QtCreator/lib/Qt/plugins/platforms/libqvnc.so"
Found metadata in lib /home/itcast/qt/Qt5.12.10/Tools/QtCreator/lib/Qt/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/itcast/qt/Qt5.12.10/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so"
Found metadata in lib /home/itcast/qt/Qt5.12.10/Tools/QtCreator/lib/Qt/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() checking directory path "/home/itcast/qt/Qt5.12.10/Tools/QtCreator/bin/platforms" ...
loaded library "/home/itcast/qt/Qt5.12.10/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so"
loaded library "Xcursor"
Segmentation fault (core dumped)

3.原因在于libqxcb.so,解决方法:

进入platform目录 : ~/qt/Qt5.12.10/5.12.10/gcc_64/plugins/platforms(注意路径和安装位置有关) 执行如下命令

ldd libqxcb.so
sudo apt install --reinstall libxcb-xinerama0
source ~/.bashrc

到这里QT就已经可以打开了(注意,QT 需要加sudo才能打开)

sudo ./qtcreator

这篇关于ubuntu安装qt5 Could not load the Qt platform plugin “xcb“ in ““ even though it was found.的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/162387

相关文章

Linux系统中卸载与安装JDK的详细教程

《Linux系统中卸载与安装JDK的详细教程》本文详细介绍了如何在Linux系统中通过Xshell和Xftp工具连接与传输文件,然后进行JDK的安装与卸载,安装步骤包括连接Linux、传输JDK安装包... 目录1、卸载1.1 linux删除自带的JDK1.2 Linux上卸载自己安装的JDK2、安装2.1

Linux卸载自带jdk并安装新jdk版本的图文教程

《Linux卸载自带jdk并安装新jdk版本的图文教程》在Linux系统中,有时需要卸载预装的OpenJDK并安装特定版本的JDK,例如JDK1.8,所以本文给大家详细介绍了Linux卸载自带jdk并... 目录Ⅰ、卸载自带jdkⅡ、安装新版jdkⅠ、卸载自带jdk1、输入命令查看旧jdkrpm -qa

MySQL Workbench 安装教程(保姆级)

《MySQLWorkbench安装教程(保姆级)》MySQLWorkbench是一款强大的数据库设计和管理工具,本文主要介绍了MySQLWorkbench安装教程,文中通过图文介绍的非常详细,对大... 目录前言:详细步骤:一、检查安装的数据库版本二、在官网下载对应的mysql Workbench版本,要是

新特性抢先看! Ubuntu 25.04 Beta 发布:Linux 6.14 内核

《新特性抢先看!Ubuntu25.04Beta发布:Linux6.14内核》Canonical公司近日发布了Ubuntu25.04Beta版,这一版本被赋予了一个活泼的代号——“Plu... Canonical 昨日(3 月 27 日)放出了 Beta 版 Ubuntu 25.04 系统镜像,代号“Pluc

springboot报错Invalid bound statement (not found)的解决

《springboot报错Invalidboundstatement(notfound)的解决》本文主要介绍了springboot报错Invalidboundstatement(not... 目录一. 问题描述二.解决问题三. 添加配置项 四.其他的解决方案4.1 Mapper 接口与 XML 文件不匹配

Linux安装MySQL的教程

《Linux安装MySQL的教程》:本文主要介绍Linux安装MySQL的教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux安装mysql1.Mysql官网2.我的存放路径3.解压mysql文件到当前目录4.重命名一下5.创建mysql用户组和用户并修

pip无法安装osgeo失败的问题解决

《pip无法安装osgeo失败的问题解决》本文主要介绍了pip无法安装osgeo失败的问题解决,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一... 进入官方提供的扩展包下载网站寻找版本适配的whl文件注意:要选择cp(python版本)和你py

Android App安装列表获取方法(实践方案)

《AndroidApp安装列表获取方法(实践方案)》文章介绍了Android11及以上版本获取应用列表的方案调整,包括权限配置、白名单配置和action配置三种方式,并提供了相应的Java和Kotl... 目录前言实现方案         方案概述一、 androidManifest 三种配置方式

Qt 中 isHidden 和 isVisible 的区别与使用小结

《Qt中isHidden和isVisible的区别与使用小结》Qt中的isHidden()和isVisible()方法都用于查询组件显示或隐藏状态,然而,它们有很大的区别,了解它们对于正确操... 目录1. 基础概念2. 区别清见3. 实际案例4. 注意事项5. 总结1. 基础概念Qt 中的 isHidd

Python解析器安装指南分享(Mac/Windows/Linux)

《Python解析器安装指南分享(Mac/Windows/Linux)》:本文主要介绍Python解析器安装指南(Mac/Windows/Linux),具有很好的参考价值,希望对大家有所帮助,如有... 目NMNkN录1js. 安装包下载1.1 python 下载官网2.核心安装方式3. MACOS 系统安