现象
执行qtcreator启动报错
[root@localhost bin]# ./qtcreator
Warning: Ignoring WAYLAND_DISPLAY on Gnome. Use
QT_QPA_PLATFORM=wayland to run on Wayland anyway.
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, vkkhrdisplay, vnc, wayland-egl, wayland, xcb.
已放弃 (核心已转储)
排查过程
查看启动过程详情
export QT_DEBUG_PLUGINS=1
./qtcreator
可以看到无法正常打开libqxcb.so
qt.core.library: "/opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so" cannot load: Cannot load
library /opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so: (libxcb-cursor.so.0: 无法打开共享对象文件: 没有那个文件或目录)
qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "/opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so" : "Cannot load library /opt/Qt/Tools/QtCreator/lib/Qt/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, linuxfb, minimal, minimalegl, offscreen, vkkhrdisplay, vnc, wayland-egl, wayland, xcb.
已放弃 (核心已转储)
查看libqxcb.so动态库关联
ldd /opt/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so
发现缺少libxcb-cursor.so.0 => not found
解决办法
到pkgs.org下载依赖包安装即可
cd /tmp/
curl -# -O https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.5/repo/oss/x86_64/libxcb-cursor0-0.1.3-150400.3.2.3.x86_64.rpm
rpm -ivh libxcb-cursor0-0.1.3-150400.3.2.3.x86_64.rpm
ldconfig