在“”中找不到 Qt 平台插件“xcb”
Posted
技术标签:
【中文标题】在“”中找不到 Qt 平台插件“xcb”【英文标题】:Could not find the Qt platform plugin "xcb" in "" 【发布时间】:2021-10-19 19:28:10 【问题描述】:我用 Qt Designer 做了一个简单的“hello world”,然后用 auto-py-to-exe 编译了它。编译期间没有错误消息,但是当我双击创建的可执行文件时,我的终端中有这个:
(venv) (base) saltz@saltz:~/Bureau/70 5 applications Qt/test/output$ ./main
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized.
Reinstalling the application may fix this problem.
Abandon (core dumped)
我在网上研究后尝试了这个
root@saltz:/home/saltz/Bureau/70 5 applications Qt/test/output# export
QT_DEBUG_PLUGINS=1
root@saltz:/home/saltz/Bureau/70 5 applications Qt/test/output# ./main
QFactoryLoader::QFactoryLoader() checking directory path "/home/saltz/Bureau/70 5
applications Qt/test/output/platforms" ...
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized.
Reinstalling the application may fix this problem.
Abandon (core dumped)
root@saltz:/home/saltz/Bureau/70 5 applications Qt/test/output# ln -sf
/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/ /usr/bin/
root@saltz:/home/saltz/Bureau/70 5 applications Qt/test/output# ./main
QFactoryLoader::QFactoryLoader() checking directory path "/home/saltz/Bureau/70 5
applications Qt/test/output/platforms" ...
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized.
Reinstalling the application may fix this problem.
Abandon (core dumped)
root@saltz:/home/saltz/Bureau/70 5 applications Qt/test/output#
还有这个
base) saltz@saltz:~/Bureau/70 5 applications Qt/test/output$ cd /usr/lib/x86_64-
linux-gnu/qt5/plugins/platforms
(base) saltz@saltz:/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms$ ldd libqxcb.so
linux-vdso.so.1 (0x00007ffda8389000)
libQt5XcbQpa.so.5 => /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5 (0x00007ff6a38e6000)
libQt5Gui.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5 (0x00007ff6a32f6000)
libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007ff6a2da6000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ff6a2bbe000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff6a29c6000)
libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1
(0x00007ff6a297e000)
libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007ff6a28be000)
libQt5DBus.so.5 => /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5 (0x00007ff6a281e000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff6a27f6000)
libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007ff6a27ee000)
libxcb-xinput.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-xinput.so.0
(0x00007ff6a27c6000)
libxcb-icccm.so.4 => /usr/lib/x86_64-linux-gnu/libxcb-icccm.so.4 (0x00007ff6a27be000)
libxcb-image.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-image.so.0 (0x00007ff6a25b6000)
libxcb-shm.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007ff6a25ae000)
libxcb-keysyms.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-keysyms.so.1
(0x00007ff6a25a6000)
libxcb-randr.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-randr.so.0 (0x00007ff6a258e000)
libxcb-render-util.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-render-util.so.0
(0x00007ff6a2586000)
libxcb-render.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-render.so.0
(0x00007ff6a2576000)
libxcb-shape.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shape.so.0 (0x00007ff6a256e000)
libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007ff6a255e000)
libxcb-xfixes.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-xfixes.so.0
(0x00007ff6a254e000)
libxcb-xinerama.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-xinerama.so.0
(0x00007ff6a2546000)
libxcb-xkb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-xkb.so.1 (0x00007ff6a2526000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007ff6a24f6000)
libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007ff6a22e6000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007ff6a21a6000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff6a2056000)
libSM.so.6 => /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007ff6a2046000)
libICE.so.6 => /usr/lib/x86_64-linux-gnu/libICE.so.6 (0x00007ff6a2026000)
libxkbcommon-x11.so.0 => /usr/lib/x86_64-linux-gnu/libxkbcommon-x11.so.0
(0x00007ff6a2016000)
libxkbcommon.so.0 => /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0 (0x00007ff6a1fce000)
libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007ff6a1e9e000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff6a1e7e000)
libGL.so.1 => /usr/lib/x86_64-linux-gnu/libGL.so.1 (0x00007ff6a1df6000)
libpng16.so.16 => /usr/lib/x86_64-linux-gnu/libpng16.so.16 (0x00007ff6a1dbe000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007ff6a1d9e000)
libharfbuzz.so.0 => /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007ff6a1c96000)
libicui18n.so.66 => /usr/lib/x86_64-linux-gnu/libicui18n.so.66 (0x00007ff6a1996000)
libicuuc.so.66 => /usr/lib/x86_64-linux-gnu/libicuuc.so.66 (0x00007ff6a17ae000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff6a17a6000)
libpcre2-16.so.0 => /usr/lib/x86_64-linux-gnu/libpcre2-16.so.0 (0x00007ff6a171e000)
libdouble-conversion.so.3 => /usr/lib/x86_64-linux-gnu/libdouble-conversion.so.3
(0x00007ff6a1706000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff6a3ac6000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007ff6a16d6000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007ff6a16c6000)
libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007ff6a166e000)
libxcb-util.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-util.so.1 (0x00007ff6a1466000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007ff6a145e000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007ff6a1456000)
libbsd.so.0 => /usr/lib/x86_64-linux-gnu/libbsd.so.0 (0x00007ff6a1436000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007ff6a13be000)
libGLdispatch.so.0 => /usr/lib/x86_64-linux-gnu/libGLdispatch.so.0
(0x00007ff6a1306000)
libGLX.so.0 => /usr/lib/x86_64-linux-gnu/libGLX.so.0 (0x00007ff6a12ce000)
libgraphite2.so.3 => /usr/lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007ff6a129e000)
libicudata.so.66 => /usr/lib/x86_64-linux-gnu/libicudata.so.66 (0x00007ff69f7d6000)
libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007ff69f726000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ff69f716000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007ff69f6e6000)
liblz4.so.1 => /usr/lib/x86_64-linux-gnu/liblz4.so.1 (0x00007ff69f6be000)
libgcrypt.so.20 => /usr/lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007ff69f59e000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007ff69f576000)
(base) saltz@saltz:/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms$
但我不明白“ldd libxcb.so”命令。
我现在能做什么?我的操作系统是 lubuntu 20.04。
【问题讨论】:
您的程序尝试在应用程序目录中查找目录plugins
,但没有找到。您应该将 plugins
从 /usr/lib/x86_64-linux-gnu/qt5/plugins/
复制到您的应用程序目录,然后重试。
【参考方案1】:
我对 gambas3 也有同样的问题。
此应用程序无法启动,因为它无法找到或加载 Qt 平台插件“xcb”。
ldd 文件 /usr/lib/qt5/plugins/platforms/libqxcb.so
给出了缺少的库
libxcb-render-util.so.0 => not found
libxcb-image.so.0 => not found
libxcb-icccm.so.4 => not found
安装它们可以解决问题。-
【讨论】:
以上是关于在“”中找不到 Qt 平台插件“xcb”的主要内容,如果未能解决你的问题,请参考以下文章
在 Linux 上从源代码构建的 Qt5 上找不到 Qt 平台插件 xcb
在 Qt3D 中找不到适合 QUrl 的导入器插件 - .dae 对象
在 Qt 中找不到 Qlistview Selectionchanged 事件?