使用 Qt 段错误的 GUI 应用程序,认为正在检查错误的路径?

使用 Qt 段错误的 GUI 应用程序,认为正在检查错误的路径?

我无法打开任何使用 Qt 库的 Ubuntu 22.04 应用程序(Konsole、P4V、Wireshark 等)。他们立即出现了段错误。

当我使用调试日志记录启动 Konsole 时,我可以看到它正在尝试查找在路径中搜索库的元数据/usr/lib/plugins/platforms

QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqminimal.so"
"Failed to extract plugin meta data from '/usr/lib/plugins/platforms/libqminimal.so'" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqoffscreen.so"
"Failed to extract plugin meta data from '/usr/lib/plugins/platforms/libqoffscreen.so'" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqvkkhrdisplay.so"
"Failed to extract plugin meta data from '/usr/lib/plugins/platforms/libqvkkhrdisplay.so'" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqvnc.so"
"Failed to extract plugin meta data from '/usr/lib/plugins/platforms/libqvnc.so'" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqxcb.so"
"Failed to extract plugin meta data from '/usr/lib/plugins/platforms/libqxcb.so'" 
         not a plugin
QFactoryLoader::QFactoryLoader() checking directory path "/usr/bin/platforms" ...
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

当我在工作系统上运行 Konsole 时,它​​会从不同的路径加载库:

QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms" ...
Found metadata in lib /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqminimal.so

这是问题所在/我该如何解决这个问题?

更新:

看来我的 QT_PLUGIN_PATH 指向了错误的值。它指的是/usr/lib/plugins/platforms应该在什么时候/usr/lib/x86_64-linux-gnu/qt5/plugins/

当我将其导出为正确的值时,Konsole 可以工作。

我从未明确改变过这一点。有没有办法重置 Qt 安装?我不进行 Qt 开发,只是需要它来开发我的 GUI 应用程序。

答案1

看来您正在运行未安装qt5-wayland或未qt6-wayland安装的 Wayland。安装它们可能会解决您的问题。

你也可以切换到 xorg 来解决这个问题,但我不建议这样做。

相关内容