作者:陈浩
特别助理:游成伟
QT移植库文件后,运行qt可执行程序,结果显示如下异常:
/home/appbin # ./armBoardLight
This application failed to start because it could not find or load the Qt platform plugin "linuxfb"
in "/home/qt/plugins".
Available platform plugins are: linuxfb, minimal, offscreen, vnc.
Reinstalling the application may fix this problem.
Aborted
/home/appbin #
在试过重新在上位机编译QT源码,重新移植QT动态库文件后,任然出现这种问题。
在arm下位机配置文件/etc/profile后面添加如下调试环境变量:
export QT_DEBUG_LUGINS=1
保存退出,然后重启下位机arm板后,上位机屏幕显示如下信息:
/home/appbin # ./armBoardLight
QFactoryLoader::QFactoryLoader() checking directory path "/home/qt/plugins" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/appbin" ...
QFactoryLoader::QFactoryLoader() looking at "/home/appbin/armBoardLight"
"Failed to extract plugin meta data from '/home/appbin/armBoardLight'"
not a plugin
QFactoryLoader::QFactoryLoader() checking directory path "/home/qt/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/home/qt/plugins/platforms/libqlinuxfb.so"
Found metadata in lib /home/qt/plugins/platforms/libqlinuxfb.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"linuxfb"
]
},
"className": "QLinuxFbIntegrationPlugin",
"debug": false,
"version": 329989
}
Got keys from plugin meta data ("linuxfb")
QFactoryLoader::QFactoryLoader() looking at "/home/qt/plugins/platforms/libqminimal.so"
Found metadata in lib /home/qt/plugins/platforms/libqminimal.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimal"
]
},
"className": "QMinimalIntegrationPlugin",
"debug": false,
"version": 329989
}
Got keys from plugin meta data ("minimal")
QFactoryLoader::QFactoryLoader() looking at "/home/qt/plugins/platforms/libqoffscreen.so"
Found metadata in lib /home/qt/plugins/platforms/libqoffscreen.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"offscreen"
]
},
"className": "QOffscreenIntegrationPlugin",
"debug": false,
"version": 329989
}
Got keys from plugin meta data ("offscreen")
QFactoryLoader::QFactoryLoader() looking at "/home/qt/plugins/platforms/libqvnc.so"
Found metadata in lib /home/qt/plugins/platforms/libqvnc.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"vnc"
]
},
"className": "QVncIntegrationPlugin",
"debug": false,
"version": 329989
}
Got keys from plugin meta data ("vnc")
QFactoryLoader::QFactoryLoader() checking directory path "/home/appbin/platforms" ...
Cannot load library /home/qt/plugins/platforms/libqlinuxfb.so: (libts-1.0.so.0: cannot open shared object file: No such file or directory)
QLibraryPrivate::loadPlugin failed on "/home/qt/plugins/platforms/libqlinuxfb.so" : "Cannot load library /home/qt/plugins/platforms/libqlinuxfb.so: (libts-1.0.so.0: cannot open shared object file: No such file or directory)"
This application failed to start because it could not find or load the Qt platform plugin "linuxfb"
in "/home/qt/plugins".
Available platform plugins are: linuxfb, minimal, offscreen, vnc.
Reinstalling the application may fix this problem.
Aborted
仔细阅读以上调试信息,发现发生真正错误处:
Cannot load library /home/qt/plugins/platforms/libqlinuxfb.so: (libts-1.0.so.0: cannot open shared object file: No such file or directory)
发现原因是缺少动态库文件libts-1.0.so.0
在上位机交叉编译器里找到这个动态库的软链接和硬链接文件,全部移植到arm板下位机,然后重启下位机,至此,下位机成功运行qt可执行文件。