我在centos 上用Qt编译了工程,并用linuxdeployqt打包,运行的时候报如下错误:
[compass@centos-linux-7 centosrelease]$ ./runApp.sh
QFactoryLoader::QFactoryLoader() checking directory path "/home/compass/Desktop/centosrelease/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/home/compass/Desktop/centosrelease/plugins/platforms/libqxcb.so"
Found metadata in lib /home/compass/Desktop/centosrelease/plugins/platforms/libqxcb.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"xcb"
]
},
"className": "QXcbIntegrationPlugin",
"debug": false,
"version": 329991
}
Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/home/compass/Desktop/centosrelease/platforms" ...
Cannot load library /home/compass/Desktop/centosrelease/plugins/platforms/libqxcb.so: (/home/compass/Desktop/centosrelease/lib/libQt5XcbQpa.so.5: symbol _ZN11QFontEngine14bitmapForGlyphEj6QFixedRK10QTransform, version Qt_5_PRIVATE_API not defined in file libQt5Gui.so.5 with link time reference)
QLibraryPrivate::loadPlugin failed on "/home/compass/Desktop/centosrelease/plugins/platforms/libqxcb.so" : "Cannot load library /home/compass/Desktop/centosrelease/plugins/platforms/libqxcb.so: (/home/compass/Desktop/centosrelease/lib/libQt5XcbQpa.so.5: symbol _ZN11QFontEngine14bitmapForGlyphEj6QFixedRK10QTransform, version Qt_5_PRIVATE_API not defined in file libQt5Gui.so.5 with link time reference)"
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: xcb.
原因是qt冲突,因为系统本身有一个qt5.9.2版本,而我自己又装了qt5.12.8,因此打包之后会有库冲突,所以根据提示错误,在系统里搜索对应的库,在qt安装目录的库,对应复制到程序lib文件夹下即可。
网友评论