gpt4 book ai didi

c++ - 在 linux 上部署 Qt5.10 App 时出错

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:16:01 24 4
gpt4 key购买 nike

我正在尝试在 Linux 上手动部署一个简单示例。

我复制了运行需要的依赖

ldd ./binaryFile

在应用程序目录中

├── app.sh
├── lib
└── testApp

在我的lib目录下

├──lib
├── plugins
├── qml
└── other .so files from ldd

然后我运行 bash 脚本

#!/bin/sh
export LD_LIBRARY_PATH=`pwd`/lib
export QML_IMPORT_PATH=`pwd`/lib/qml
export QML2_IMPORT_PATH=`pwd`/lib/qml
export QT_QPA_PLATFORM_PLUGIN_PATH=`pwd`/lib/plugins/platforms
#export QT_DEBUG_PLUGINS=0
./testApp

但是我得到了这个错误

This application failed to start because it could not find or load the Qt platform plugin "xcb" in "/home/zed/Desktop/testDep/lib/plugins/platforms".

Available platform plugins are: eglfs (from /home/zed/Desktop/testDep/lib/plugins/platforms), linuxfb (from /home/zed/Desktop/testDep/lib/plugins/platforms), minimal (from /home/zed/Desktop/testDep/lib/plugins/platforms), minimalegl (from /home/zed/Desktop/testDep/lib/plugins/platforms), offscreen (from /home/zed/Desktop/testDep/lib/plugins/platforms), vnc (from /home/zed/Desktop/testDep/lib/plugins/platforms), webgl (from /home/zed/Desktop/testDep/lib/plugins/platforms), xcb (from /home/zed/Desktop/testDep/lib/plugins/platforms).

Reinstalling the application may fix this problem. ./app.sh: line 7: 1948 Aborted (core dumped) ./testApp

即使“xcb”插件在平台目录中

当我运行它时使用

export QT_DEBUG_PLUGINS=1

我收到了这条调试消息

Got keys from plugin meta data ("xcb") QFactoryLoader::QFactoryLoader() checking directory path "/home/zed/Desktop/testDep" ... QFactoryLoader::QFactoryLoader() looking at "/home/zed/Desktop/testDep/app.sh" QElfParser: '/home/zed/Desktop/testDep/app.sh' is not an ELF object "'/home/zed/Desktop/testDep/app.sh' is not an ELF object" 
not a plugin QFactoryLoader::QFactoryLoader() looking at "/home/zed/Desktop/testDep/testApp" "Failed to extract plugin meta data from '/home/zed/Desktop/testDep/testApp'"
not a plugin Cannot load library /home/zed/Desktop/testDep/lib/plugins/platforms/libqxcb.so: (/usr/lib/libQt5XcbQpa.so.5: symbol
_ZNK15QPlatformWindow15safeAreaMarginsEv version Qt_5_PRIVATE_API not defined in file libQt5Gui.so.5 with link time reference) QLibraryPrivate::loadPlugin failed on "/home/zed/Desktop/testDep/lib/plugins/platforms/libqxcb.so" : "Cannot load library /home/zed/Desktop/testDep/lib/plugins/platforms/libqxcb.so: (/usr/lib/libQt5XcbQpa.so.5: symbol
_ZNK15QPlatformWindow15safeAreaMarginsEv version Qt_5_PRIVATE_API not defined in file libQt5Gui.so.5 with link time reference)" QFactoryLoader::QFactoryLoader() checking directory path "/home/zed/Desktop/testDep/lib/plugins/platforms/platforms" ... QFactoryLoader::QFactoryLoader() checking directory path "/home/zed/Desktop/testDep/platforms" ... This application failed to start because it could not find or load the Qt platform plugin "xcb" in "/home/zed/Desktop/testDep/lib/plugins/platforms".

有办法解决这个问题吗?

附言:Qt 版本:5.10编译于:Kubuntu 18.4测试于:Manjaro XFCE 17.1

最佳答案

看来两台机器上使用的 Qt 版本不匹配

/home/zed/Desktop/testDep/lib/plugins/platforms/libqxcb.so: (/usr/lib/libQt5XcbQpa.so.5: It was looking for that file in the OS libs not the libs I provided, I copied the required files from Kubuntu machine to the lib directory deployment machine and that fixed the issue

关于c++ - 在 linux 上部署 Qt5.10 App 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51767824/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com