我正在尝试手动在linux上部署一个简单的示例。
我复制了运行所需的依赖项
ldd ./binaryFile在app目录中
├── 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".有办法解决这个问题吗?
PS: Qt版本: 5.10编译在: Kubuntu 18.4上测试: Manjaro XFCE 17.1
发布于 2018-08-09 18:00:05
在这两台机器上使用的Qt版本似乎不匹配
/home/zed/Desktop/testDep/lib/plugins/platforms/libqxcb.so: (/usr/lib/libQt5XcbQpa.so.5:它在OS库中寻找那个文件,而不是我提供的lib,我将所需的文件从Kubuntu机器复制到lib目录部署机器,并修复了这个问题。
https://stackoverflow.com/questions/51767824
复制相似问题