跨境派

跨境派

跨境派,专注跨境行业新闻资讯、跨境电商知识分享!

当前位置:首页 > 工具系统 > 运营工具 > Qt运行程序报错:Could not load the Qt platform plugin “xcb“ in ““ even though it was found

Qt运行程序报错:Could not load the Qt platform plugin “xcb“ in ““ even though it was found

时间:2024-04-23 18:45:30 来源:网络cs 作者:璐璐 栏目:运营工具 阅读:

标签: 程序  运行 

Qt运行程序报以下错误:

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, vkkhrdisplay, linuxfb, minimalegl, offscreen, wayland-egl, minimal, xcb, vnc, wayland.

按照网上查到的办法,在 ~/.bashrc 文件末尾加上

export QT_DEBUG_PLUGINS=1

用source命令使其生效

source ~/.bashrc

在终端中重新运行程序,打印了详细的报错信息:

qt.core.plugin.factoryloader: checking directory path "/home/bosscome/Develop/bosscome/fib_modify/repo/dev/bin/platforms" ... qt.core.library: "/home/bosscome/Qt/Qt6/6.5.1/gcc_64/plugins/platforms/libqxcb.so" cannot load: Cannot load library /home/bosscome/Qt/Qt6/6.5.1/gcc_64/plugins/platforms/libqxcb.so: (libxcb-cursor.so.0: 无法打开共享对象文件: 没有那个文件或目录) qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "/home/bosscome/Qt/Qt6/6.5.1/gcc_64/plugins/platforms/libqxcb.so" : "Cannot load library /home/bosscome/Qt/Qt6/6.5.1/gcc_64/plugins/platforms/libqxcb.so: (libxcb-cursor.so.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, vkkhrdisplay, linuxfb, minimalegl, offscreen, wayland-egl, minimal, xcb, vnc, wayland.

发现报错的真正原因来源于Qt动态库加载的问题,跟随网上的步骤,跳转到对应的动态库目录,用ldd命令执行该动态库,进一步分析报错原因:

ldd /home/bosscome/Qt/Qt6/6.5.1/gcc_64/plugins/platforms/libqxcb.so

分析输出内容,发现有两个动态库 not found(其实是同一个):

linux-vdso.so.1 (0x00007fff1cda5000)
libQt6XcbQpa.so.6 => /home/bosscome/Qt/Qt6/6.5.1/gcc_64/plugins/platforms/../../lib/libQt6XcbQpa.so.6 (0x00007fca4b960000)
libxkbcommon-x11.so.0 => /lib/x86_64-linux-gnu/libxkbcommon-x11.so.0 (0x00007fca4b93f000)
libxkbcommon.so.0 => /lib/x86_64-linux-gnu/libxkbcommon.so.0 (0x00007fca4b8fd000)
libxcb-cursor.so.0 => not found
libxcb-icccm.so.4 => /lib/x86_64-linux-gnu/libxcb-icccm.so.4 (0x00007fca4b8f6000)
libxcb-image.so.0 => /lib/x86_64-linux-gnu/libxcb-image.so.0 (0x00007fca4b6f1000)
libxcb-keysyms.so.1 => /lib/x86_64-linux-gnu/libxcb-keysyms.so.1 (0x00007fca4b6ea000)
libxcb-randr.so.0 => /lib/x86_64-linux-gnu/libxcb-randr.so.0 (0x00007fca4b6d7000)
libxcb-render-util.so.0 => /lib/x86_64-linux-gnu/libxcb-render-util.so.0 (0x00007fca4b6d0000)
libxcb-shm.so.0 => /lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007fca4b6cb000)
libxcb-sync.so.1 => /lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007fca4b6c1000)
libxcb-xfixes.so.0 => /lib/x86_64-linux-gnu/libxcb-xfixes.so.0 (0x00007fca4b6b7000)
libxcb-render.so.0 => /lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007fca4b6a6000)
libxcb-shape.so.0 => /lib/x86_64-linux-gnu/libxcb-shape.so.0 (0x00007fca4b6a1000)
libxcb-xkb.so.1 => /lib/x86_64-linux-gnu/libxcb-xkb.so.1 (0x00007fca4b683000)
libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fca4b659000)
libQt6OpenGL.so.6 => /home/bosscome/Qt/Qt6/6.5.1/gcc_64/plugins/platforms/../../lib/libQt6OpenGL.so.6 (0x00007fca4b5b7000)
libQt6Gui.so.6 => /home/bosscome/Qt/Qt6/6.5.1/gcc_64/plugins/platforms/../../lib/libQt6Gui.so.6 (0x00007fca4abf3000)
libGL.so.1 => /lib/x86_64-linux-gnu/libGL.so.1 (0x00007fca4ab69000)
libQt6Core.so.6 => /home/bosscome/Qt/Qt6/6.5.1/gcc_64/plugins/platforms/../../lib/libQt6Core.so.6 (0x00007fca4a4df000)
libX11-xcb.so.1 => /lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007fca4a4da000)
libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007fca4a39d000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fca4a397000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fca4a374000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fca4a190000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fca4a041000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fca4a026000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fca49e34000)
libxcb-cursor.so.0 => not found
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fca49d0b000)
libgthread-2.0.so.0 => /lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007fca49d04000)
libxcb-util.so.1 => /lib/x86_64-linux-gnu/libxcb-util.so.1 (0x00007fca49afe000)
libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007fca49af8000)
libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fca49af0000)
libEGL.so.1 => /lib/x86_64-linux-gnu/libEGL.so.1 (0x00007fca49adb000)
libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007fca49a92000)
libQt6DBus.so.6 => /home/bosscome/Qt/Qt6/6.5.1/gcc_64/plugins/platforms/../../lib/libQt6DBus.so.6 (0x00007fca499cc000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fca499b0000)
libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007fca498f1000)
libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007fca49839000)
libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007fca49805000)
libicui18n.so.56 => /home/bosscome/Qt/Qt6/6.5.1/gcc_64/plugins/platforms/../../lib/libicui18n.so.56 (0x00007fca4936a000)
libicuuc.so.56 => /home/bosscome/Qt/Qt6/6.5.1/gcc_64/plugins/platforms/../../lib/libicuuc.so.56 (0x00007fca48fb2000)
libicudata.so.56 => /home/bosscome/Qt/Qt6/6.5.1/gcc_64/plugins/platforms/../../lib/libicudata.so.56 (0x00007fca475cf000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fca475c5000)
/lib64/ld-linux-x86-64.so.2 (0x00007fca4ba1b000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fca47552000)
libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007fca47536000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fca47508000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007fca474ff000)
libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007fca474ae000)
libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007fca47476000)
libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007fca473c5000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fca4739c000)
liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007fca4737b000)
libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007fca4725d000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007fca4723a000)

那就安装它(注意缺失的动态库名 .so 后面的那个数字):

sudo apt install libxcb-cursor0

安装完后再次运行动态库,发现已经没有 not found 了

重新运行我们自己的程序,一切正常了。。。。。。

本文链接:https://www.kjpai.cn/news/2024-04-23/161593.html,文章来源:网络cs,作者:璐璐,版权归作者所有,如需转载请注明来源和作者,否则将追究法律责任!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。

上一篇:ssh远程连接服务器

下一篇:返回列表

文章评论