一个命令,解决libxcb-util.so.1 => not found
操作系统:深度Linux 20.2社区版本。


2021-4-26从Qt官网下下载了开源版本安装包 qt-unified-linux-x64-4.1.0-online.run,运行,下载后,双击qtcreator启动图标,死活不能启动。

最终解决办法:

向博主致敬

解决过程:

  1. 双击图标,没有任何提示,并且本人忘记qtcreator可执行文件路径了。于是从启动器将启动图标发送到桌面,获得启动文件路径:~/Qt/Tools/QtCreator/bin/qtcreator
  2. cd 到路径~/Qt/Tools/QtCreator/bin/下,在命令行执行qtcreator.sh脚本文件,获得报错信息,搜索报错信息,很容易找到如下一篇文章:初始报错信息一致
  3. 按照博主步骤,修改qt调试环境变量export QT_DEBUG_PLUGINS=1注销或者重启系统,重复步骤2.
  4. 出现详细报错信息,但是注意,这时报错信息,和上面博主报错信息是不一致的,我们需要差别化处理。我的报错信息是:
QElfParser: '/home/fozei/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/not' is not an ELF object (file too small)
QLibraryPrivate::loadPlugin failed on "/home/fozei/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so" : "Cannot load library /home/fozei/Qt/Tools/QtCreator/lib/Qt/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, xcb.

已放弃
  1. cd到~/Qt/Tools/QtCreator/lib/Qt/plugins/platforms,执行ldd libqxcb.so | grep found,我们这里发现,终端输出libxcb-util.so.1 => not found,缺失的依赖是libxcb-util.so.1
  2. 这里疑惑了好久,尝试安装libxcb-util,但是apt提示我系统上libxcb-util已经是最新的了。
  3. 求助深度论坛,三楼,提出,这个是qt的bug,引导我到了这个地址QTBUG-REPORT
  4. QTBUG-REPORT这里,这个问题的详情是发生在5.15.2,再后续版本已经解决,且问题已经关闭。
  5. 然后我把安装好的qt卸载了,重新安装,安装了高版本,结果还是这个问题。
  6. 最后,折腾半天,搜到了解决方案中那个不是很高答的链接。
cd /usr/lib/x86_64-linux-gnu
sudo ln -s libxcb-util.so.0  libxcb-util.so.1

后记

其实在步骤7时,就应该想到。这确实是Qt的bug,估计qt的开发人员使用的Linux版本不是Debian系的,依赖了libxcb-util.so.1,然而在Debian系上,这个依赖库不叫libxcb-util.so.1,而叫libxcb-util.so.0,所以,为其添加软连接即可。

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐