| 
 | 
	
 
 本帖最后由 Qter 于 2023-4-13 14:29 编辑  
 
安装完成后,运行自带的demo报如下错误:- 14:10:12: Debugging /home/admin/Qt5.15.2/Examples/Qt-5.15.2/widgets/itemviews/build-addressbook-Desktop_Qt_5_15_2_GCC_64bit-Debug/addressbook ...
 
 - 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, webgl, xcb.
 
  复制代码 在~/.bashrc中添加QT_DEBUG_PLUGINS在编译过程中可列出详细错误,亦可直接export:- export QT_DEBUG_PLUGINS=1
 
  复制代码- admin@admin:~/Qt5.15.2/Examples/Qt-5.15.2/widgets/itemviews/build-addressbook-Desktop_Qt_5_15_2_GCC_64bit-Debug$ ./addressbook 
 
 - Found metadata in lib /home/admin/Qt5.15.2/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
 
 - }
 
  
 
- Found metadata in lib /home/admin/Qt5.15.2/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
 
 - }
 
  
 
- Found metadata in lib /home/admin/Qt5.15.2/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
 
 - }
 
  
 
- Found metadata in lib /home/admin/Qt5.15.2/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
 
 - }
 
  
 
- Found metadata in lib /home/admin/Qt5.15.2/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
 
 - }
 
  
 
- Found metadata in lib /home/admin/Qt5.15.2/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
 
 - }
 
  
 
- Found metadata in lib /home/admin/Qt5.15.2/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
 
 - }
 
  
 
- Found metadata in lib /home/admin/Qt5.15.2/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
 
 - }
 
  
 
- Found metadata in lib /home/admin/Qt5.15.2/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
 
 - }
 
  
 
- Found metadata in lib /home/admin/Qt5.15.2/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
 
 - }
 
  
 
- Found metadata in lib /home/admin/Qt5.15.2/5.15.2/gcc_64/plugins/platforms/libqwebgl.so, metadata=
 
 - {
 
 -     "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
 
 -     "MetaData": {
 
 -         "Keys": [
 
 -             "webgl"
 
 -         ]
 
 -     },
 
 -     "archreq": 0,
 
 -     "className": "QWebGLIntegrationPlugin",
 
 -     "debug": false,
 
 -     "version": 331520
 
 - }
 
  
 
- Found metadata in lib /home/admin/Qt5.15.2/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
 
 - }
 
  
 
- QLibraryPrivate::loadPlugin failed on "/home/admin/Qt5.15.2/5.15.2/gcc_64/plugins/platforms/libqxcb.so" : "Cannot load library /home/admin/Qt5.15.2/5.15.2/gcc_64/plugins/platforms/libqxcb.so: (libxcb-util.so.1: 无法打开共享对象文件: 没有那个文件或目录)"
 
 - 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, webgl, xcb.
 
 
  复制代码 处,主要是动态链接库的问题,在加载libqxcb.so库的时候,还需要加载libxcb-xinerama库。那么不存在libxcb-xinerama.so.0库,就安装这个库。 
 
sudo apt-get install libxcb-xinerama0 
1 
如果安装完libxcb-xinerama.so.0仍不能解决问题,可能是因为图形库开发人员的系统环境不一样,只依赖了libxcb-util.so.1,然而在Debian系统中对应libxcb-util.so.1的库名称为libxcb-util.so.0,因而可将进行符号链接,将libxcb-util.so.1软链接到libxcb-util.so.0。 
 
cd /usr/lib/x86_64-linux-gnu/ 
sudo ln -s libxcb-util.so.0  libxcb-util.so.1 
1 
2 
亦可: 
 
sudo ln -s /usr/lib/x86_64-linux-gnu/libxcb-util.so.0  /usr/lib/x86_64-linux-gnu/libxcb-util.so.1 
1 
在创建后即可解决问题,后续可将QT_DEBUG_PLUGINS关掉或删掉。 
———————————————— 
版权声明:本文为CSDN博主「chase。」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 
原文链接:https://blog.csdn.net/weixin_39284111/article/details/119480436 
 
 |   
 
 
 
 |