QT 应用程序迁移异常记录:找不到 xcb-cursor0
1.概要
2.内容
1
topeet@topeet:~/unknown-Debug$ QT_DEBUG_PLUGINS=1 ./SanliApp
qt.core.plugin.factoryloader: checking directory path "/home/topeet/unknown-Debug/platforms" ...
qt.core.plugin.factoryloader: checking directory path "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms" ...
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqminimal.so"
qt.core.plugin.loader: Found metadata in lib /home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqminimal.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimal"
]
},
"archlevel": 0,
"className": "QMinimalIntegrationPlugin",
"debug": false,
"version": 395008
}
qt.core.plugin.factoryloader: Got keys from plugin meta data QList("minimal")
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/qvkkhrdisplay.debug"
qt.core.plugin.factoryloader: "The shared library was not found."
not a plugin
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/qwayland-generic.debug"
qt.core.plugin.factoryloader: "The shared library was not found."
not a plugin
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/qoffscreen.debug"
qt.core.plugin.factoryloader: "The shared library was not found."
not a plugin
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/qminimalegl.debug"
qt.core.plugin.factoryloader: "The shared library was not found."
not a plugin
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqminimalegl.so"
qt.core.plugin.loader: Found metadata in lib /home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqminimalegl.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimalegl"
]
},
"archlevel": 0,
"className": "QMinimalEglIntegrationPlugin",
"debug": false,
"version": 395008
}
qt.core.plugin.factoryloader: Got keys from plugin meta data QList("minimalegl")
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqxcb.so"
qt.core.plugin.loader: Found metadata in lib /home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqxcb.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"xcb"
]
},
"archlevel": 0,
"className": "QXcbIntegrationPlugin",
"debug": false,
"version": 395008
}
qt.core.plugin.factoryloader: Got keys from plugin meta data QList("xcb")
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqwayland-generic.so"
qt.core.plugin.loader: Found metadata in lib /home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqwayland-generic.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland"
]
},
"archlevel": 0,
"className": "QWaylandIntegrationPlugin",
"debug": false,
"version": 395008
}
qt.core.plugin.factoryloader: Got keys from plugin meta data QList("wayland")
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/qxcb.debug"
qt.core.plugin.factoryloader: "The shared library was not found."
not a plugin
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqvnc.so"
qt.core.plugin.loader: Found metadata in lib /home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqvnc.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"vnc"
]
},
"archlevel": 0,
"className": "QVncIntegrationPlugin",
"debug": false,
"version": 395008
}
qt.core.plugin.factoryloader: Got keys from plugin meta data QList("vnc")
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/qwayland-egl.debug"
qt.core.plugin.factoryloader: "The shared library was not found."
not a plugin
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/qvnc.debug"
qt.core.plugin.factoryloader: "The shared library was not found."
not a plugin
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/qminimal.debug"
qt.core.plugin.factoryloader: "The shared library was not found."
not a plugin
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/qlinuxfb.debug"
qt.core.plugin.factoryloader: "The shared library was not found."
not a plugin
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqeglfs.so"
qt.core.plugin.loader: Found metadata in lib /home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqeglfs.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"eglfs"
]
},
"archlevel": 0,
"className": "QEglFSIntegrationPlugin",
"debug": false,
"version": 395008
}
qt.core.plugin.factoryloader: Got keys from plugin meta data QList("eglfs")
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqvkkhrdisplay.so"
qt.core.plugin.loader: Found metadata in lib /home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqvkkhrdisplay.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"vkkhrdisplay"
]
},
"archlevel": 0,
"className": "QVkKhrDisplayIntegrationPlugin",
"debug": false,
"version": 395008
}
qt.core.plugin.factoryloader: Got keys from plugin meta data QList("vkkhrdisplay")
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/qeglfs.debug"
qt.core.plugin.factoryloader: "The shared library was not found."
not a plugin
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqoffscreen.so"
qt.core.plugin.loader: Found metadata in lib /home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqoffscreen.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"offscreen"
]
},
"archlevel": 0,
"className": "QOffscreenIntegrationPlugin",
"debug": false,
"version": 395008
}
qt.core.plugin.factoryloader: Got keys from plugin meta data QList("offscreen")
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqwayland-egl.so"
qt.core.plugin.loader: Found metadata in lib /home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqwayland-egl.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland-egl"
]
},
"archlevel": 0,
"className": "QWaylandEglPlatformIntegrationPlugin",
"debug": false,
"version": 395008
}
qt.core.plugin.factoryloader: Got keys from plugin meta data QList("wayland-egl")
qt.core.plugin.factoryloader: looking at "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqlinuxfb.so"
qt.core.plugin.loader: Found metadata in lib /home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqlinuxfb.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"linuxfb"
]
},
"archlevel": 0,
"className": "QLinuxFbIntegrationPlugin",
"debug": false,
"version": 395008
}
qt.core.plugin.factoryloader: Got keys from plugin meta data QList("linuxfb")
qt.core.library: "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqxcb.so" cannot load: Cannot load library /home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqxcb.so: libQt6XcbQpa.so.6: æ æ³æ å¼å
±äº«å¯¹è±¡æä»¶: 没æ é£ä¸ªæä»¶æç
qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqxcb.so" : "Cannot load library /home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqxcb.so: libQt6XcbQpa.so.6: æ\u0097 æ³\u0095æ\u0089\u0093å¼\u0080å\u0085±äº«å¯¹è±¡æ\u0096\u0087ä»¶: 没æ\u009C\u0089é\u0082£ä¸ªæ\u0096\u0087ä»¶æ\u0088\u0096ç\u009B®å½\u0095"
qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms" 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: minimal, minimalegl, xcb, wayland, vnc, eglfs, vkkhrdisplay, offscreen, wayland-egl, linuxfb.
已放弃 (核心已转储)
topeet@topeet:~/unknown-Debug$ find / -name "libQt6XcbQpa.so.6" 2>/dev/null
topeet@topeet:~/unknown-Debug$ sudo find / -name "libQt6XcbQpa.so.6" 2>/dev/null~
bash: /dev/null~: 权限不够
topeet@topeet:~/unknown-Debug$ export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms
topeet@topeet:~/unknown-Debug$ QT_DEBUG_PLUGINS=1 ./SanliApp
qt.core.plugin.factoryloader: checking directory path "/home/topeet/unknown-Debug/platforms" ...
qt.core.plugin.factoryloader: checking directory path "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms" ...
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimal.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimal.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimal"
]
},
"archlevel": 0,
"className": "QMinimalIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimal.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimal.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimalegl.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimalegl.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimalegl"
]
},
"archlevel": 0,
"className": "QMinimalEglIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimalegl.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimalegl.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqxcb.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqxcb.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"xcb"
]
},
"archlevel": 0,
"className": "QXcbIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqxcb.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqxcb.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-generic.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-generic.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland"
]
},
"archlevel": 0,
"className": "QWaylandIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-generic.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-generic.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqvnc.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqvnc.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"vnc"
]
},
"archlevel": 0,
"className": "QVncIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqvnc.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqvnc.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-glx.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-glx.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland-xcomposite-glx"
]
},
"archlevel": 0,
"className": "QWaylandXCompositeGlxPlatformIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-glx.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-glx.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-egl.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-egl.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland-xcomposite-egl"
]
},
"archlevel": 0,
"className": "QWaylandXCompositeEglPlatformIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-egl.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-egl.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqeglfs.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqeglfs.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"eglfs"
]
},
"archlevel": 0,
"className": "QEglFSIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqeglfs.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqeglfs.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqoffscreen.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqoffscreen.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"offscreen"
]
},
"archlevel": 0,
"className": "QOffscreenIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqoffscreen.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqoffscreen.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-egl.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-egl.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland-egl"
]
},
"archlevel": 0,
"className": "QWaylandEglPlatformIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-egl.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-egl.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqlinuxfb.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqlinuxfb.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"linuxfb"
]
},
"archlevel": 0,
"className": "QLinuxFbIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqlinuxfb.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqlinuxfb.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms"
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
已放弃 (核心已转储)
从你提供的日志来看,你遇到的问题是关于Qt平台插件加载失败的问题。这通常是因为缺少必要的库文件或者库文件版本不兼容。以下是针对你遇到问题的详细分析和建议解决方案:
问题分析
- Qt xcb平台插件加载失败:
- 日志显示Qt试图加载
libqxcb.so插件,但失败了,因为找不到依赖的libQt6XcbQpa.so.6库。 - 错误信息指出,从Qt 6.5.0开始,需要
xcb-cursor0或libxcb-cursor0库来加载Qt xcb平台插件。
- 日志显示Qt试图加载
- 插件版本不兼容:
- 当你尝试从
/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms加载插件时,所有找到的插件都使用了不兼容的Qt库(5.15.0),而你的应用程序似乎是基于Qt 6.7.8构建的。
- 当你尝试从
解决方案
- 安装缺失的库:
- 你需要安装
libxcb-cursor0库。你可以使用包管理器来安装它,例如在Debian或Ubuntu系统上:sudo apt-get update sudo apt-get install libxcb-cursor0
- 你需要安装
- 确保使用正确的Qt版本:
- 确保你的系统路径中只包含与你的应用程序兼容的Qt版本。你的应用程序是基于Qt 6.7.8构建的,所以你应该确保所有的Qt库和插件都是这个版本的。
- 检查你的环境变量
LD_LIBRARY_PATH和QT_QPA_PLATFORM_PLUGIN_PATH,确保它们指向正确的Qt 6.7.8目录。
- 重新构建或配置你的应用程序:
- 如果可能,重新构建你的应用程序,确保链接到正确的Qt库。
- 检查你的CMakeLists.txt或qmake项目文件,确保它们指向正确的Qt安装路径。
- 检查系统上的Qt版本:
- 使用
find命令查找系统上安装的Qt库版本,确保没有混淆不同版本的库。 - 清理任何可能导致版本冲突的旧Qt安装。
- 使用
- 运行应用程序:
- 在解决了上述问题后,再次尝试运行你的应用程序,看看问题是否得到解决。
如果以上步骤仍然无法解决问题,可能需要更详细地检查你的应用程序的配置和构建过程,或者考虑在支持Qt 6.7.8的环境中重新部署你的应用程序。
1.翻译
topeet@topeet:~/unknown-Debug$ QT_DEBUG_PLUGINS=1 ./SanliApp
qt.core.plugin.factoryloader: 检查目录路径 "/home/topeet/unknown-Debug/platforms" ...
qt.core.plugin.factoryloader: 检查目录路径 "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms" ...
qt.core.plugin.factoryloader: 查看 "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqminimal.so"
qt.core.plugin.loader: 在库 /home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqminimal.so 中找到元数据,元数据为:
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimal"
]
},
"archlevel": 0,
"className": "QMinimalIntegrationPlugin",
"debug": false,
"version": 395008
}
qt.core.plugin.factoryloader: 从插件元数据中获取到键 QList("minimal")
qt.core.plugin.factoryloader: 查看 "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/qvkkhrdisplay.debug"
qt.core.plugin.factoryloader: "未找到共享库。"
不是插件
qt.core.plugin.factoryloader: 查看 "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/qwayland-generic.debug"
qt.core.plugin.factoryloader: "未找到共享库。"
不是插件
qt.core.plugin.factoryloader: 查看 "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/qoffscreen.debug"
qt.core.plugin.factoryloader: "未找到共享库。"
不是插件
qt.core.plugin.factoryloader: 查看 "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/qminimalegl.debug"
qt.core.plugin.factoryloader: "未找到共享库。"
不是插件
qt.core.plugin.factoryloader: 查看 "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqminimalegl.so"
qt.core.plugin.loader: 在库 /home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqminimalegl.so 中找到元数据,元数据为:
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimalegl"
]
},
"archlevel": 0,
"className": "QMinimalEglIntegrationPlugin",
"debug": false,
"version": 395008
}
qt.core.plugin.factoryloader: 从插件元数据中获取到键 QList("minimalegl")
qt.core.plugin.factoryloader: 查看 "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqxcb.so"
qt.core.plugin.loader: 在库 /home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqxcb.so 中找到元数据,元数据为:
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"xcb"
]
},
"archlevel": 0,
"className": "QXcbIntegrationPlugin",
"debug": false,
"version": 395008
}
qt.core.plugin.factoryloader: 从插件元数据中获取到键 QList("xcb")
qt.core.plugin.factoryloader: 查看 "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqwayland-generic.so"
qt.core.plugin.loader: 在库 /home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqwayland-generic.so 中找到元数据,元数据为:
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland"
]
},
"archlevel": 0,
"className": "QWaylandIntegrationPlugin",
"debug": false,
"version": 395008
}
qt.core.plugin.factoryloader: 从插件元数据中获取到键 QList("wayland")
qt.core.plugin.factoryloader: 查看 "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/qxcb.debug"
qt.core.plugin.factoryloader: "未找到共享库。"
不是插件
qt.core.plugin.factoryloader: 查看 "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqvnc.so"
qt.core.plugin.loader: 在库 /home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqvnc.so 中找到元数据,元数据为:
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"vnc"
]
},
"archlevel": 0,
"className": "QVncIntegrationPlugin",
"debug": false,
"version": 395008
}
qt.core.plugin.factoryloader: 从插件元数据中获取到键 QList("vnc")
qt.core.plugin.factoryloader: 查看 "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/qwayland-egl.debug"
qt.core.plugin.factoryloader: "未找到共享库。"
不是插件
qt.core.plugin.factoryloader: 查看 "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/qvnc.debug"
qt.core.plugin.factoryloader: "未找到共享库。"
不是插件
qt.core.plugin.factoryloader: 查看 "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/qminimal.debug"
qt.core.plugin.factoryloader: "未找到共享库。"
不是插件
qt.core.plugin.factoryloader: 查看 "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/qlinuxfb.debug"
qt.core.plugin.factoryloader: "未找到共享库。"
不是插件
qt.core.plugin.factoryloader: 查看 "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqeglfs.so"
qt.core.plugin.loader: 在库 /home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqeglfs.so 中找到元数据,元数据为:
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"eglfs"
]
},
"archlevel": 0,
"className": "QEglFSIntegrationPlugin",
"debug": false,
"version": 395008
}
qt.core.plugin.factoryloader: 从插件元数据中获取到键 QList("eglfs")
qt.core.plugin.factoryloader: 查看 "/home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqvkkhrdisplay.so"
qt.core.plugin.loader: 在库 /home/topeet/qtlib/qt6.7.8/gcc_arm64/plugins/platforms/libqvkkhrdisplay.so 中找到元数据,元数据为:
{
2
topeet@topeet:~/unknown-Debug$ QT_DEBUG_PLUGINS=1 ./SanliApp
qt.core.plugin.factoryloader: checking directory path "/home/topeet/unknown-Debug/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.
你的问题与Qt平台插件的加载失败有关,特别是xcb插件。以下是可能的解决方法:
1. 确认依赖是否安装完整
xcb是Qt在Linux下用于图形界面的插件,它依赖于一些系统库。请确保你的系统安装了以下包(以Ubuntu为例):
sudo apt update
sudo apt install libx11-xcb1 libxcb1 libxcomposite1 libxcb-keysyms1 libxcb-image0 libxcb-shm0 libxcb-icccm4 libxcb-sync1 libxcb-render-util0
2. 检查Qt平台插件路径
程序运行时会在特定路径查找Qt插件。你需要确保platforms目录存在并包含libqxcb.so文件。通常,这个文件位于Qt安装路径下,比如:
/path/to/Qt/plugins/platforms/libqxcb.so
你可以通过以下命令检查路径是否正确:
ldd ./SanliApp | grep xcb
3. 设置环境变量
如果插件路径不正确,你可以尝试手动设置QT_QPA_PLATFORM_PLUGIN_PATH环境变量。例如,如果platforms目录位于/path/to/Qt/plugins,运行以下命令:
export QT_QPA_PLATFORM_PLUGIN_PATH=/path/to/Qt/plugins
./SanliApp
4. 检查文件权限和完整性
确保libqxcb.so及相关依赖库有正确的文件权限:
chmod +r /path/to/Qt/plugins/platforms/libqxcb.so
如果你使用的版本是通过自己编译的,也可以尝试重新编译Qt,确保编译和安装没有问题。
5. 使用strace调试
如果上述方法无效,可以用strace工具查看程序具体在加载库时的行为:
strace -e open ./SanliApp
查看输出中是否成功打开了libqxcb.so,以及是否有其他库加载失败的提示。
6. 重新安装或重新编译
如果问题仍未解决,可以尝试以下步骤:
- 重新安装Qt:如果你是通过包管理器安装的Qt,可以尝试重新安装。
- 重新编译项目:如果你是开发者,确保在编译时正确设置了Qt路径,并确认所有依赖库都已正确链接。
总结
最常见的原因是系统缺少xcb相关依赖库或环境变量配置错误。按照上述方法逐步排查即可解决问题。如果依然无法解决,可以提供更多细节,比如Qt版本、操作系统版本及具体的编译或安装方式。
1.strace工具
strace 是一个强大的 Linux 调试工具,用于追踪进程执行期间的系统调用和信号。通过拦截和记录应用程序执行期间所调用的所有系统调用,以及内核返回的结果,strace 能够帮助开发者深入了解程序的行为,诊断问题。
一、strace 的主要用途
-
调试程序:strace 可以帮助开发者定位程序崩溃、异常行为或挂起状态的原因。通过分析系统调用,了解程序在执行过程中是如何与操作系统交互的,从而找到潜在的问题。
-
性能分析:strace 可以统计系统调用的执行时间,识别出性能瓶颈所在。
-
监控文件访问和网络活动:strace 可以记录程序的文件操作和网络请求,帮助管理员监控和分析程序的行为。
二、strace 的基本用法
1. 安装 strace
在大多数 Linux 发行版中,strace 都可以通过包管理器进行安装。例如:
-
Debian/Ubuntu:
sudo apt-get updatesudo apt-get install strace -
CentOS/RHEL:
sudo yum install strace
2. 使用 strace
基本命令格式为:
strace [选项] [命令] |
-
选项:用于控制 strace 的行为,如输出格式、跟踪范围等。
-
命令:要跟踪的应用程序或脚本。
3. 常用选项
-
-f:跟踪由程序创建的所有子进程,这对于调试多线程或多进程程序非常有用。
-
-o 文件名:将输出重定向到指定文件,而不是标准错误输出。例如,
strace -o trace_output.txt ./myapp会将输出写入trace_output.txt文件中。 -
-p PID:跟踪已经运行的进程,需要提供进程的 PID(进程 ID)。例如,
strace -p 1234会开始跟踪进程 ID 为 1234 的系统调用。 -
-T:在输出中包含每个系统调用的执行时间,有助于分析性能瓶颈。
-
-tt:显示系统调用的精确时间戳,适合分析程序何时进入某个系统调用以及调用的顺序。
-
-e trace=系统调用名:仅跟踪特定的系统调用。例如,
strace -e trace=open,read,write ./myapp只跟踪open、read、write系统调用。 -
-e trace=file:只跟踪文件系统相关的系统调用,如
open、stat、read、write等。 -
-e trace=network:只跟踪网络相关的系统调用,如
socket、connect、send、recv等。 -
-c:统计每个系统调用的执行时间,并生成调用次数的统计信息。
三、strace 的输出格式
strace 的输出格式如下:
系统调用名(参数) = 返回值 |
每行显示了系统调用的名称、参数、返回值,以及有时还会显示错误信息(如 ENOENT 表示文件未找到)。例如:
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
read(3, "..." , 83296) = 83296
close(3) = 0
四、strace 的应用场景
1. 调试程序崩溃
例如,程序在某个系统调用(如 open、read、write 等)失败后崩溃,strace 可以帮助捕获失败的系统调用及其返回值。
2. 监控文件访问
如果程序由于权限不足而无法访问某些文件,strace 可以显示出 open 或其他相关系统调用的失败原因。
3. 分析性能瓶颈
通过统计系统调用的执行时间,识别出性能瓶颈所在。例如,在一个实际的业务系统出现大量延迟的故障排查过程中,最初误认为是数据库或网络问题,但通过 strace 工具分析发现,真正的瓶颈在于业务逻辑中的日志写入操作,导致 rsyslog 调用耗时过长。移除这部分日志写入后,问题得到解决。
五、strace 的局限性
-
性能开销:strace 会增加系统调用的开销,特别是在大量系统调用的情况下,这可能会影响程序的性能。因此,在实时应用或高并发环境中使用时需要谨慎。
-
输出复杂:strace 的输出可能非常庞大且复杂,难以分析。为了解决这个问题,可以限制跟踪的系统调用数量或使用文本处理工具(如
grep、awk等)进行过滤。 -
权限问题:strace 需要足够的权限来跟踪其他进程的系统调用。
六、总结
strace 是一个强大的 Linux 调试工具,通过跟踪进程执行期间的系统调用和信号,帮助开发者深入了解程序的行为,诊断问题。它广泛应用于程序调试、性能分析和系统监控等领域。在使用时,需要注意其性能开销和输出复杂性,并结合实际需求选择合适的选项和参数。
2.libx11-xcb1 libxcb1 libxcomposite1 libxcb-keysyms1 libxcb-image0 libxcb-shm0 libxcb-icccm4 libxcb-sync1 libxcb-render-util0
以下是这些动态库的表格说明,包括库名称和其作用:
| 动态库名称 | 作用 |
|---|---|
| libx11-xcb1 | 提供 X11 客户端库对 XCB(X Client-side Library)的支持,使得应用程序可以通过 XCB 接口与 X 服务器进行通信。XCB 是一个轻量级的、低开销的 X 协议库。 |
| libxcb1 | X Client-side Library,提供 X 协议的一个 C 语言接口,允许应用程序直接与 X 服务器进行通信,而不依赖于传统的 Xlib。XCB 设计为更轻量和更高效。 |
| libxcomposite1 | 提供对 X Composite 扩展的支持,使得应用程序可以使用复合窗口管理功能,如窗口透明度、阴影等。 |
| libxcb-keysyms1 | 提供 XCB 库对键盘符号(keysym)的支持,使得应用程序可以更方便地处理键盘输入事件。 |
| libxcb-image0 | 提供 XCB 库对图像扩展的支持,允许应用程序在 X 服务器上绘制和操作图像。 |
| libxcb-shm0 | 提供 XCB 库对共享内存(SHM)扩展的支持,使得应用程序可以更有效地在客户端和服务器之间传输图像数据。 |
| libxcb-icccm4 | 提供 XCB 库对 ICCCM(Inter-Client Communication Conventions Manual)的支持,这是 X 窗口系统中客户端之间通信的规范。 |
| libxcb-sync1 | 提供 XCB 库对同步扩展的支持,允许应用程序更精确地控制 X 服务器上的绘制操作顺序。 |
| libxcb-render-util0 | 提供 XCB 库对渲染实用程序的支持,这些实用程序简化了在 X 服务器上使用渲染扩展进行绘图的过程。 |
这些动态库通常用于 X 窗口系统中的图形界面应用程序开发,提供对 X 协议的各种扩展和功能的支持,使得开发者可以更高效地创建和管理窗口、处理输入事件、绘制图像等。这些库是 X 窗口系统开发中不可或缺的一部分,特别是在需要高性能和低开销的场景中。
3
topeet@topeet:~/unknown-Debug$ QT_DEBUG_PLUGINS=1 ./SanliApp
qt.core.plugin.factoryloader: checking directory path "/home/topeet/unknown-Debug/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.
从调试输出可以看出,程序正在尝试从路径 /home/topeet/unknown-Debug/platforms 加载 Qt 平台插件,但未能找到 xcb 插件。以下是一些可能的解决方案:
1. 确认插件路径
确保 xcb 插件存在于你的应用程序的插件目录中。检查路径 /home/topeet/unknown-Debug/platforms 是否有 libqxcb.so 文件:
ls /home/topeet/unknown-Debug/platforms/libqxcb.so
如果文件不存在,你可能需要从 Qt 安装目录中复制这些插件到你的应用程序目录。
2. 复制 Qt 系统插件
如果你的系统上已经正确安装了 Qt,你可以尝试从系统的 Qt 插件目录复制 xcb 插件到你的应用程序目录。通常,系统插件目录位于 /usr/lib/qt/plugins/platforms 或 /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms。
例如:
cp /usr/lib/qt/plugins/platforms/libqxcb.so /home/topeet/unknown-Debug/platforms/
确保同时复制所有相关的依赖文件。如果 libqxcb.so 是一个符号链接,确保复制它指向的实际文件。
3. 设置环境变量
如果插件存在于其他路径,你可以通过设置 QT_QPA_PLATFORM_PLUGIN_PATH 环境变量来告知应用程序插件的位置。例如:
export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/qt/plugins
./SanliApp
根据你的系统调整路径。
4. 检查 Qt 安装
确保你的系统上安装了完整的 Qt 运行时库,包括 xcb 插件。你可以尝试重新安装 Qt:
sudo apt install --reinstall qt5-default
或者如果你使用的是 Qt6:
sudo apt install --reinstall qt6-base-dev
5. 使用 ldd 检查依赖
使用 ldd 命令检查 libqxcb.so 的依赖库是否都存在。例如:
ldd /usr/lib/qt/plugins/platforms/libqxcb.so
确保所有列出的库都存在于你的系统中。如果缺少任何库,安装相应的包。
6. 检查应用程序构建配置
如果你是自己构建的应用程序,确保在构建时正确配置了 Qt 插件路径。检查你的构建工具(如 CMake 或 qmake)的配置文件,确保插件路径被正确设置。
通过这些步骤,你应该能够解决 xcb 插件找不到的问题。如果问题仍然存在,请确认你的 Qt 安装和应用程序构建环境没有其他配置问题。
4
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqlinuxfb.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqlinuxfb.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms"
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
从错误信息来看,存在以下问题:
-
不兼容的 Qt 库:
libqlinuxfb.so插件使用的 Qt 库版本与应用程序期望的版本不兼容。插件使用的是 Qt 5.15.0,而你的应用程序可能期望其他版本。 -
找不到
xcb插件:应用程序未能找到xcb平台插件。
以下是一些可能的解决方案:
1. 检查 Qt 版本一致性
确保应用程序运行时使用的 Qt 库版本与插件的版本一致。你可以通过以下命令检查系统上安装的 Qt 版本:
qmake -v
或者如果你使用的是 Qt6:
qt6-qmake -v
确保应用程序构建和运行时使用的 Qt 版本一致。如果不一致,可能需要调整你的开发环境或者重新安装相应的 Qt 版本。
2. 安装正确的 Qt 平台插件
确保系统上安装了 xcb 平台插件。你可以尝试安装以下包:
sudo apt install libqt5xcb-qpa5
如果你使用的是 Qt6:
sudo apt install libqt6xcb-qpa6
3. 设置环境变量
如果插件存在于其他路径,你可以通过设置 QT_QPA_PLATFORM_PLUGIN_PATH 环境变量来告知应用程序插件的位置。例如:
export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/aarch64-linux-gnu/qt5/plugins
./SanliApp
确保路径正确并且包含 libqxcb.so 文件。
4. 检查符号链接
有时候,插件文件可能是符号链接,确保符号链接指向正确的库文件。检查 libqxcb.so 是否为符号链接,并验证其目标文件是否存在:
ls -l /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqxcb.so
5. 重新安装 Qt 和相关插件
如果以上方法无效,可能需要重新安装 Qt 和相关插件:
sudo apt install --reinstall qt5-default
或者对于 Qt6:
sudo apt install --reinstall qt6-base-dev
6. 构建环境检查
如果你是自己构建的应用程序,确保在构建时使用了正确的 Qt 版本,并且构建环境没有混淆多个 Qt 版本。清理构建目录并重新构建应用程序:
make clean
qmake
make
或者使用 CMake:
rm -rf build
mkdir build
cd build
cmake ..
make
通过这些步骤,你应该能够解决 Qt 库版本不兼容和 xcb 插件找不到的问题。如果问题仍然存在,请确认你的开发环境和运行环境没有其他配置问题。
1.libqlinuxfb.so
关于 libqlinuxfb.so,这是 Qt 框架中的一个插件,用于在 Linux 系统上使用 Framebuffer 设备进行图形输出。它主要用于嵌入式系统或者在没有图形界面的环境(如服务器)中使用。以下是对 libqlinuxfb.so 的详细解释和一些常见问题的解决方案:
一、libqlinuxfb.so 的作用
libqlinuxfb.so 是 Qt 框架中的一个平台插件,它允许 Qt 应用程序直接通过 Linux Framebuffer 接口进行图形输出。这在嵌入式系统或没有图形界面的服务器环境中非常有用,因为它不依赖于 X Window System 或其他图形服务器。
二、常见问题及解决方案
-
插件加载失败
- 错误描述:应用程序启动时报错,提示无法加载
libqlinuxfb.so或插件版本不兼容。 - 可能原因:
- Qt 库版本与插件版本不匹配。
- 插件文件损坏或丢失。
- 插件文件路径未正确设置。
- 解决方案:
- 确保应用程序使用的 Qt 库版本与插件版本一致。
- 检查插件文件是否存在且未损坏。
- 设置环境变量
QT_QPA_PLATFORM_PLUGIN_PATH,指定插件的搜索路径。
- 错误描述:应用程序启动时报错,提示无法加载
-
找不到 xcb 插件
- 错误描述:应用程序启动时报错,提示无法找到
xcb平台插件。 - 可能原因:
- 系统未安装 xcb 相关插件。
- Qt 配置错误,导致未正确加载 xcb 插件。
- 解决方案:
- 安装 xcb 相关插件。例如,在基于 Debian 的系统中,可以运行
sudo apt-get install libqt5xcb-qpa5(对于 Qt5)或sudo apt-get install libqt6xcb-qpa6(对于 Qt6)。 - 检查 Qt 配置文件,确保 xcb 插件被正确加载。
- 安装 xcb 相关插件。例如,在基于 Debian 的系统中,可以运行
- 错误描述:应用程序启动时报错,提示无法找到
-
Framebuffer 配置问题
- 问题描述:应用程序启动后,图形输出异常或无法显示。
- 可能原因:
- Framebuffer 设备配置错误。
- 应用程序未正确设置 Framebuffer 参数。
- 解决方案:
- 检查 Framebuffer 设备的配置,确保分辨率、颜色深度等参数设置正确。
- 在应用程序中,通过设置环境变量
QT_QPA_PLATFORM_PLUGIN_PATH和QT_QPA_PLATFORM,指定使用linuxfb插件,并设置 Framebuffer 的相关参数。例如:
export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/aarch64-linux-gnu/qt5/plugins export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:size=1920x1080:mmSize=220x124:offset=0x0 ./your_application
三、总结
libqlinuxfb.so 是 Qt 框架中用于 Linux Framebuffer 输出的重要插件。在使用时,需要确保 Qt 库版本与插件版本一致,插件文件未损坏且路径设置正确。同时,对于 Framebuffer 的配置也需要仔细检查和调整,以确保图形输出的正确性和稳定性。如果遇到问题,可以参考上述解决方案进行排查和修复。
5
topeet@topeet:~/unknown-Debug$ QT_DEBUG_PLUGINS=1 ./SanliApp
qt.core.plugin.factoryloader: checking directory path "/home/topeet/unknown-Debug/platforms" ...
qt.core.plugin.factoryloader: checking directory path "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms" ...
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimal.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimal.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimal"
]
},
"archlevel": 0,
"className": "QMinimalIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimal.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimal.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimalegl.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimalegl.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimalegl"
]
},
"archlevel": 0,
"className": "QMinimalEglIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimalegl.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimalegl.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqxcb.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqxcb.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"xcb"
]
},
"archlevel": 0,
"className": "QXcbIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqxcb.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqxcb.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-generic.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-generic.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland"
]
},
"archlevel": 0,
"className": "QWaylandIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-generic.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-generic.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqvnc.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqvnc.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"vnc"
]
},
"archlevel": 0,
"className": "QVncIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqvnc.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqvnc.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-glx.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-glx.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland-xcomposite-glx"
]
},
"archlevel": 0,
"className": "QWaylandXCompositeGlxPlatformIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-glx.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-glx.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-egl.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-egl.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland-xcomposite-egl"
]
},
"archlevel": 0,
"className": "QWaylandXCompositeEglPlatformIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-egl.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-egl.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqeglfs.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqeglfs.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"eglfs"
]
},
"archlevel": 0,
"className": "QEglFSIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqeglfs.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqeglfs.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqoffscreen.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqoffscreen.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"offscreen"
]
},
"archlevel": 0,
"className": "QOffscreenIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqoffscreen.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqoffscreen.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-egl.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-egl.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland-egl"
]
},
"archlevel": 0,
"className": "QWaylandEglPlatformIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-egl.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-egl.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.core.plugin.factoryloader: looking at "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqlinuxfb.so"
qt.core.plugin.loader: Found metadata in lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqlinuxfb.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"linuxfb"
]
},
"archlevel": 0,
"className": "QLinuxFbIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: In /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqlinuxfb.so:
Plugin uses incompatible Qt library (5.15.0) [release]
qt.core.plugin.factoryloader: "The plugin '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqlinuxfb.so' uses incompatible Qt library. (5.15.0) [release]"
not a plugin
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms"
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
已放弃 (核心已转储)
从你提供的日志来看,问题的核心在于 Qt 插件使用的 Qt 库版本与应用程序期望的版本不一致。这种情况通常发生在以下情形之一:
- 系统上安装了多个版本的 Qt,并且插件或应用程序链接到了不同的版本。
- 应用程序被编译时使用的 Qt 版本与系统上当前可用的 Qt 版本不匹配。
解决方案
以下是一些可能的解决步骤:
1. 检查 Qt 版本
首先,确保应用程序和插件使用的是同一版本的 Qt。你可以通过以下命令检查系统上安装的 Qt 版本:
qmake -v
如果你有多个 Qt 版本,确保应用程序和插件都指向你希望使用的版本。
2. 设置环境变量
你可以通过设置环境变量来指定应用程序使用的 Qt 插件路径和库路径。这有助于确保应用程序使用正确的 Qt 版本。
export QT_QPA_PLATFORM_PLUGIN_PATH=/path/to/correct/qt/plugins/platforms
export LD_LIBRARY_PATH=/path/to/correct/qt/lib:$LD_LIBRARY_PATH
./SanliApp
将 /path/to/correct/qt 替换为你希望应用程序使用的 Qt 安装路径。
3. 检查插件的符号链接
确保插件文件是正确的符号链接,并且指向有效的库文件。你可以使用 ls -l 命令检查插件文件的符号链接:
ls -l /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/
4. 重新安装 Qt 和相关插件
如果以上方法无效,可能需要重新安装 Qt 和相关插件以确保版本一致性:
sudo apt update
sudo apt install --reinstall qt5-default
或者如果你使用的是 Qt6:
sudo apt install --reinstall qt6-base-dev
5. 清理和重新编译应用程序
如果你有应用程序的源代码,可以尝试清理和重新编译应用程序,确保在编译时使用的 Qt 版本与系统上的 Qt 版本一致。
make clean
qmake
make
或者使用 CMake:
rm -rf build
mkdir build
cd build
cmake ..
make
6. 检查其他依赖项
确保应用程序的所有依赖项都与 Qt 版本兼容。有时其他库或插件也可能导致版本不匹配的问题。
通过这些步骤,你应该能够解决 Qt 库版本不兼容的问题。如果问题仍然存在,请确认你的开发环境和运行环境没有其他配置问题,并考虑检查应用程序的构建脚本或配置文件以确保使用正确的 Qt 版本。
1.翻译
topeet@topeet:~/unknown-Debug$ QT_DEBUG_PLUGINS=1 ./SanliApp
qt.core.plugin.factoryloader: 检查目录路径 "/home/topeet/unknown-Debug/platforms" ...
qt.core.plugin.factoryloader: 检查目录路径 "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms" ...
qt.core.plugin.factoryloader: 查看 "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimal.so"
qt.core.plugin.loader: 在 lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimal.so 中找到元数据,元数据为:
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimal"
]
},
"archlevel": 0,
"className": "QMinimalIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: 在 /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimal.so 中:
插件使用了不兼容的 Qt 库 (5.15.0) [发行版]
qt.core.plugin.factoryloader: "插件 '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimal.so' 使用了不兼容的 Qt 库。(5.15.0) [发行版]"
不是插件
qt.core.plugin.factoryloader: 查看 "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimalegl.so"
qt.core.plugin.loader: 在 lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimalegl.so 中找到元数据,元数据为:
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimalegl"
]
},
"archlevel": 0,
"className": "QMinimalEglIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: 在 /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimalegl.so 中:
插件使用了不兼容的 Qt 库 (5.15.0) [发行版]
qt.core.plugin.factoryloader: "插件 '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqminimalegl.so' 使用了不兼容的 Qt 库。(5.15.0) [发行版]"
不是插件
qt.core.plugin.factoryloader: 查看 "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqxcb.so"
qt.core.plugin.loader: 在 lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqxcb.so 中找到元数据,元数据为:
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"xcb"
]
},
"archlevel": 0,
"className": "QXcbIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: 在 /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqxcb.so 中:
插件使用了不兼容的 Qt 库 (5.15.0) [发行版]
qt.core.plugin.factoryloader: "插件 '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqxcb.so' 使用了不兼容的 Qt 库。(5.15.0) [发行版]"
不是插件
qt.core.plugin.factoryloader: 查看 "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-generic.so"
qt.core.plugin.loader: 在 lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-generic.so 中找到元数据,元数据为:
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland"
]
},
"archlevel": 0,
"className": "QWaylandIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: 在 /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-generic.so 中:
插件使用了不兼容的 Qt 库 (5.15.0) [发行版]
qt.core.plugin.factoryloader: "插件 '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-generic.so' 使用了不兼容的 Qt 库。(5.15.0) [发行版]"
不是插件
qt.core.plugin.factoryloader: 查看 "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqvnc.so"
qt.core.plugin.loader: 在 lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqvnc.so 中找到元数据,元数据为:
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"vnc"
]
},
"archlevel": 0,
"className": "QVncIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: 在 /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqvnc.so 中:
插件使用了不兼容的 Qt 库 (5.15.0) [发行版]
qt.core.plugin.factoryloader: "插件 '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqvnc.so' 使用了不兼容的 Qt 库。(5.15.0) [发行版]"
不是插件
qt.core.plugin.factoryloader: 查看 "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-glx.so"
qt.core.plugin.loader: 在 lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-glx.so 中找到元数据,元数据为:
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland-xcomposite-glx"
]
},
"archlevel": 0,
"className": "QWaylandXCompositeGlxPlatformIntegrationPlugin",
"debug": false,
"version": 331520
}
qt.core.plugin.loader: 在 /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-glx.so 中:
插件使用了不兼容的 Qt 库 (5.15.0) [发行版]
qt.core.plugin.factoryloader: "插件 '/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-glx.so' 使用了不兼容的 Qt 库。(5.15.0) [发行版]"
不是插件
qt.core.plugin.factoryloader: 查看 "/usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-egl.so"
qt.core.plugin.loader: 在 lib /usr/lib/aarch64-linux-gnu/qt5/plugins/platforms/libqwayland-xcomposite-egl.so 中找到元数据,元数据为:
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"wayland-xcomposite-egl"
]
},
"archlevel": 0,
"className": "QWaylandXCompositeEgl
6
topeet@topeet:~/unknown-Debug$ ldd ./SanliApp
linux-vdso.so.1 (0x0000007fa423b000)
libQt6Network.so.6 => not found
libQt6Charts.so.6 => not found
libQt6SerialPort.so.6 => not found
librknnrt.so => /lib/librknnrt.so (0x0000007fa3900000)
libQt6Widgets.so.6 => not found
libQt6Gui.so.6 => not found
libGLX.so.0 => /lib/aarch64-linux-gnu/libGLX.so.0 (0x0000007fa38b0000)
libOpenGL.so.0 => /lib/aarch64-linux-gnu/libOpenGL.so.0 (0x0000007fa3840000)
libQt6Core.so.6 => not found
libstdc++.so.6 => /lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000007fa3610000)
libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000007fa3570000)
libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000007fa3540000)
libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007fa3390000)
/lib/ld-linux-aarch64.so.1 (0x0000007fa4202000)
libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000007fa3370000)
libGLdispatch.so.0 => /lib/aarch64-linux-gnu/libGLdispatch.so.0 (0x0000007fa31e0000)
libX11.so.6 => /lib/aarch64-linux-gnu/libX11.so.6 (0x0000007fa3090000)
libxcb.so.1 => /lib/aarch64-linux-gnu/libxcb.so.1 (0x0000007fa3050000)
libXau.so.6 => /lib/aarch64-linux-gnu/libXau.so.6 (0x0000007fa3030000)
libXdmcp.so.6 => /lib/aarch64-linux-gnu/libXdmcp.so.6 (0x0000007fa3010000)
libbsd.so.0 => /lib/aarch64-linux-gnu/libbsd.so.0 (0x0000007fa2fe0000)
libmd.so.0 => /lib/aarch64-linux-gnu/libmd.so.0 (0x0000007fa2fc0000)
从你的 ldd 命令输出来看,有几个 Qt6 的库(如 libQt6Network.so.6、libQt6Charts.so.6 等)未找到(not found)。这通常意味着这些库没有正确安装,或者它们的路径未包含在系统的库路径中。
以下是解决此问题的步骤:
1. 确认系统架构
从输出中可以看出,你的系统是 aarch64 架构(ARM 64 位处理器)。因此,你需要确保下载或安装的 Qt6 库是适配 aarch64 架构的。
2. 安装缺失的 Qt6 库
你可以通过以下几种方式安装这些库:
方式 1:通过包管理器安装
如果你的系统有支持 Qt6 的包管理器(如 Ubuntu/Debian 的 apt),可以直接使用命令安装所需的库。例如:
sudo apt update
sudo apt install qt6-base qt6-network qt6-charts qt6-serialport qt6-widgets qt6-core
注意: 包名可能因操作系统的版本而不同,请确保搜索和安装适配的 Qt6 库。
方式 2:手动下载和安装
如果你的系统的包管理器没有最新的 Qt6 库,或者你需要特定版本,可以从 Qt 官方网站 下载对应的库。
- 下载适配
aarch64架构的 Qt6 安装包(通常是.deb、.tar.xz或其他格式)。 - 安装所需的库。例如,如果你下载了
.deb包,可以用以下命令安装:
或者解压sudo dpkg -i libqt6network6_*.deb libqt6charts6_*.deb libqt6serialport6_*.deb.tar.xz并手动将库文件复制到/usr/lib/aarch64-linux-gnu/目录下。
方式 3:通过源码编译安装
如果你无法找到预编译的库,可以从 Qt 的源码开始编译。这种方式较为复杂,建议仅在必要时选择。
3. 更新库路径
即使正确安装了这些库,有时系统可能仍无法找到它们。这可能是因为库路径未包含在 LD_LIBRARY_PATH 环境变量中。
你可以通过以下步骤确认并更新库路径:
-
查找 Qt6 库的安装位置:
find /usr -name "libQt6Network.so.6"假设输出为
/usr/lib/aarch64-linux-gnu/libQt6Network.so.6。 -
将包含 Qt6 库的路径添加到
LD_LIBRARY_PATH环境变量中。例如:export LD_LIBRARY_PATH=/usr/lib/aarch64-linux-gnu:$LD_LIBRARY_PATH -
如果需要永久生效,可以将上述命令添加到
~/.bashrc文件中:nano ~/.bashrc添加以下内容:
export LD_LIBRARY_PATH=/usr/lib/aarch64-linux-gnu:$LD_LIBRARY_PATH保存后执行:
source ~/.bashrc
4. 检查依赖库
确保所有依赖库都已正确安装。例如,你的输出中 libGLX.so.0 和 libOpenGL.so.0 等库已经找到,但如果其他库缺失,也可能导致程序无法运行。
可以用以下命令检查是否还有未找到的库:
ldd ./SanliApp
如果仍有 not found 的库,请重复上述步骤安装缺失的库。
5. 测试程序
完成上述步骤后,再次尝试运行你的程序:
./SanliApp
如果程序正常运行,说明问题已经解决。
总结
你需要安装缺失的 Qt6 库(如 libQt6Network.so.6 等),并确保它们的路径被正确加载到系统中。优先通过包管理器安装,如果不可用,可以手动下载或编译这些库。同时,检查和更新 LD_LIBRARY_PATH 环境变量,确保动态链接器可以找到所有依赖的库。
1.build-essential libgl1-mesa-dev libx11-dev libx11-xcb-dev libxcb1-dev libx11-xcb-dev libxkbcommon-dev libxkbcommon-x11-dev
上述列出的内容是一些与 Qt6 框架相关的模块。Qt 是一个跨平台的 C++ 应用程序开发框架,广泛用于开发图形用户界面 (GUI) 和非 GUI 程序。以下是这些模块的主要功能简介:
-
qt6-base
通常是 Qt6 的基础模块集合,包含核心功能和一些基本组件,是开发 Qt 应用程序所必需的部分。 -
qt6-network
提供网络编程支持,使开发者能够轻松地实现 HTTP、TCP、UDP 等协议通信,用于创建网络相关的应用。 -
qt6-charts
提供绘制图表和可视化数据的功能,支持柱状图、折线图、饼图等多种图表类型,适合数据展示需求。 -
qt6-serialport
支持串口通信功能,用于与串口设备交互,常用于硬件开发、嵌入式设备通信等场景。 -
qt6-widgets
包含用于创建传统桌面应用程序的窗口小部件(如按钮、文本框、菜单栏等),是开发 GUI 应用的重要模块。 -
qt6-core
提供 Qt 的核心功能,如时间、文件、字符串、事件循环等基本功能,是所有 Qt 应用程序的基础模块。
如果你正在开发一个项目,可以根据需要选择安装和使用这些模块。Qt6 提供了模块化设计,允许开发者仅加载所需的模块,从而优化程序的大小和性能。
7
01:31:39: Debugging /home/topeet/untitled3/build/unknown-Debug/untitled3 ...
the debug information found in "/home/topeet/Qt/6.7.2/gcc_arm64/lib/Qt6Core.debug" does not match "/home/topeet/Qt/6.7.2/gcc_arm64/lib/libQt6Core.so.6" (CRC mismatch).
the debug information found in "/home/topeet/Qt/6.7.2/gcc_arm64/lib/Qt6Core.debug" does not match "/home/topeet/Qt/6.7.2/gcc_arm64/lib/libQt6Core.so.6" (CRC mismatch).
Detected locale "C" with character encoding "ANSI_X3.4-1968", which is not UTF-8.
Qt depends on a UTF-8 locale, and has switched to "C.UTF-8" instead.
If this causes problems, reconfigure your locale. See the locale(1) manual
for more information.
Usage: app <executable_path>
根据您提供的调试输出信息,这里有几个可能的问题以及解决方法:
1. Debug 信息 CRC 不匹配
错误信息:
the debug information found in "/home/topeet/Qt/6.7.2/gcc_arm64/lib/Qt6Core.debug" does not match "/home/topeet/Qt/6.7.2/gcc_arm64/lib/libQt6Core.so.6" (CRC mismatch).
这说明调试信息文件(.debug)与实际的库文件(.so)不匹配,可能由于以下原因导致:
- 编译时的 Qt 库版本与运行时使用的库版本不一致。
- 库文件或调试符号文件被意外修改或损坏。
解决方法:
- 确保构建项目和运行时的 Qt 环境完全一致。检查您的
QTDIR环境变量是否指向正确的 Qt 版本路径。 - 如果可能,清理并重新安装 Qt,例如:
通过cd /home/topeet/Qt/6.7.2/gcc_arm64./maintaintoolmaintaintool修复或重新安装相关组件。 - 检查是否混用了不同架构的库文件(比如 ARM 和 x86),确保所有库一致。
2. Locale 设置问题
错误信息:
Detected locale "C" with character encoding "ANSI_X3.4-1968", which is not UTF-8.
Qt depends on a UTF-8 locale, and has switched to "C.UTF-8" instead.
Qt 需要运行在 UTF-8 编码的环境下,而当前系统的默认区域设置(locale)不是 UTF-8,这可能导致某些字符显示问题。
解决方法:
- 修改系统的
locale配置:- 编辑
/etc/locale.gen文件,确保包含以下行:en_US.UTF-8 UTF-8 - 运行以下命令生成新的区域设置:
sudo locale-gen - 将默认区域设置改为 UTF-8,例如:
您可以把这两行添加到export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8~/.bashrc文件中以永久生效。
- 编辑
- 如果只是临时运行程序,可以在运行命令前设置环境变量:
LANG=C.UTF-8 ./your_program
3. 命令行参数提示
错误信息:
Usage: app <executable_path>
这说明您运行的程序可能需要指定一个可执行文件路径作为参数,而未正确提供。
解决方法:
检查程序的正确使用方法。在终端运行以下命令查看帮助:
./your_program --help
或者根据提示提供一个有效的可执行文件路径,例如:
./your_program /path/to/executable
总结
- 检查 Qt 环境的版本和库文件一致性。
- 配置系统为 UTF-8 区域设置。
- 正确提供程序所需的命令行参数。
如果以上方法仍无法解决问题,请进一步提供详细的上下文、项目配置或代码片段,以便更具体地排查问题。
1.翻译
1:31:39: 正在调试 /home/topeet/untitled3/build/unknown-Debug/untitled3 ...
在 "/home/topeet/Qt/6.7.2/gcc_arm64/lib/Qt6Core.debug" 中找到的调试信息与 "/home/topeet/Qt/6.7.2/gcc_arm64/lib/libQt6Core.so.6" 不匹配(CRC 不一致)。
在 "/home/topeet/Qt/6.7.2/gcc_arm64/lib/Qt6Core.debug" 中找到的调试信息与 "/home/topeet/Qt/6.7.2/gcc_arm64/lib/libQt6Core.so.6" 不匹配(CRC 不一致)。
检测到区域设置 "C" 使用的字符编码为 "ANSI_X3.4-1968",这不是 UTF-8。
Qt 依赖于 UTF-8 区域设置,并已切换到 "C.UTF-8"。
如果这引起问题,请重新配置您的区域设置。有关更多信息,请参阅 locale(1) 手册。
用法:app <可执行文件路径>。
2.zh_CN.UTF-8 UTF-8
您提到的 zh_CN.UTF-8 UTF-8 是指设置系统的区域设置(locale)为简体中文(中国)并使用 UTF-8 编码。这是一个常见的配置,尤其是在中文环境下使用 Linux 系统时。
如何设置系统的区域设置为 zh_CN.UTF-8
- 编辑
/etc/locale.gen文件:- 打开终端,使用文本编辑器(如
nano或vim)编辑/etc/locale.gen文件:sudo nano /etc/locale.gen - 找到或添加以下行,确保没有被注释掉(即行首没有
#):zh_CN.UTF-8 UTF-8
- 打开终端,使用文本编辑器(如
- 生成新的区域设置:
- 保存并关闭文件后,运行以下命令以生成新的区域设置:
sudo locale-gen
- 编辑
/etc/default/locale文件(如果不存在,可以创建它):sudo nano /etc/default/locale - 添加或修改以下内容:
LANG=zh_CN.UTF-8 LC_ALL=zh_CN.UTF-8 - 这将设置系统的默认语言和环境为简体中文,并使用 UTF-8 编码。
- 保存并关闭文件后,运行以下命令以生成新的区域设置:
- 应用更改:
- 重新启动系统或注销并重新登录,以应用新的区域设置。
- 您也可以在当前会话中通过运行以下命令来临时应用更改:
export LANG=zh_CN.UTF-8 export LC_ALL=zh_CN.UTF-8
- 验证设置:
- 运行以下命令以验证当前区域设置:
locale - 您应该看到输出中包含
LANG=zh_CN.UTF-8和LC_ALL=zh_CN.UTF-8。
- 运行以下命令以验证当前区域设置:
通过这些步骤,您可以将系统的区域设置配置为简体中文(中国)并使用 UTF-8 编码,从而确保 Qt 和其他依赖 UTF-8 的应用程序能够正常运行。
3.Detected locale "C" with character encoding "ANSI_X3.4-1968", which is not UTF-8. Qt depends on a UTF-8 locale, and has switched to "C.UTF-8" instead.
这条错误信息表明,您的系统当前使用的区域设置(locale)是 "C",其字符编码为 "ANSI_X3.4-1968"(这是一种非常基础的字符编码,不支持多字节字符集,如中文)。由于 Qt 依赖于 UTF-8 编码来正确处理字符,它自动切换到了 "C.UTF-8" 作为替代。
虽然 "C.UTF-8" 可以让 Qt 正常工作,但可能不是您期望的区域设置,尤其是在需要处理中文字符时。因此,建议您将系统的区域设置更改为支持 UTF-8 的语言设置,例如 "zh_CN.UTF-8"(简体中文)。
如何解决
以下是设置系统区域设置为 "zh_CN.UTF-8" 的步骤:
- 检查可用的区域设置:
- 在终端中运行以下命令,查看系统支持的区域设置:
locale -a - 确保列表中包含
"zh_CN.UTF-8"。
- 在终端中运行以下命令,查看系统支持的区域设置:
- 生成所需的区域设置:
- 如果
"zh_CN.UTF-8"不在列表中,您需要先生成它:sudo locale-gen zh_CN.UTF-8
- 如果
- 设置默认区域设置:
- 编辑
/etc/default/locale文件(如果不存在,可以创建它):sudo nano /etc/default/locale - 添加或修改以下内容:
LANG=zh_CN.UTF-8 LC_ALL=zh_CN.UTF-8
- 编辑
- 应用更改:
- 重新启动系统或注销并重新登录,以应用新的区域设置。
- 如果您希望立即应用更改,可以在当前会话中运行以下命令:
export LANG=zh_CN.UTF-8 export LC_ALL=zh_CN.UTF-8
- 验证设置:
- 运行以下命令以验证当前区域设置:
locale - 您应该看到输出中包含
LANG=zh_CN.UTF-8和LC_ALL=zh_CN.UTF-8。
- 运行以下命令以验证当前区域设置:
通过这些步骤,您可以确保系统使用支持中文的 UTF-8 区域设置,从而避免 Qt 应用程序中的字符编码问题。
4./etc/locale.gen
/etc/locale.gen 是一个配置文件,用于指定系统中需要生成哪些区域设置(locale)。这个文件通常用于基于 Debian 的 Linux 发行版(如 Ubuntu)中。通过编辑这个文件并运行 locale-gen 命令,您可以生成所需的区域设置。
如何编辑 /etc/locale.gen
- 打开文件:
- 使用文本编辑器(如
nano、vim或其他您喜欢的编辑器)打开/etc/locale.gen文件:sudo nano /etc/locale.gen
- 使用文本编辑器(如
- 编辑文件:
- 在文件中,您会看到许多类似
en_US.UTF-8 UTF-8的行。这些行表示可以生成的区域设置。 - 找到或添加您需要的区域设置。例如,要生成简体中文的区域设置,确保以下行没有被注释掉(即行首没有
#):zh_CN.UTF-8 UTF-8 - 如果您需要其他区域设置,也确保相应的行没有被注释掉。
- 在文件中,您会看到许多类似
- 保存并退出:
- 保存文件的修改并退出编辑器。在
nano中,您可以通过按Ctrl + O保存,然后按Ctrl + X退出。
- 保存文件的修改并退出编辑器。在
- 生成区域设置:
- 运行以下命令以根据
/etc/locale.gen文件的内容生成区域设置:sudo locale-gen
- 运行以下命令以根据
注意事项
- 注释和取消注释:在
/etc/locale.gen文件中,通过在行首添加或删除#来注释或取消注释某个区域设置。 - 多个区域设置:您可以生成多个区域设置,只需确保相应的行没有被注释掉。
- 应用更改:生成新的区域设置后,您可能需要重新启动系统或注销并重新登录,或者手动设置环境变量(如
LANG和LC_ALL)以应用更改。
通过编辑 /etc/locale.gen 文件并运行 locale-gen 命令,您可以灵活地配置系统支持的区域设置,确保应用程序(如 Qt 应用程序)能够正确处理字符编码和区域设置相关的功能。
3.关联链接
4.关联知识
更多推荐



所有评论(0)