This application failed to start because it could not find or load the Qt platform plugin "linuxfb"

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/Guet_Kite/article/details/89222741

你好!这里是风筝的博客,

欢迎和我一起交流。


在ARM板子上执行QT程序的时候,发现错误:

This application failed to start because it could not find or load the Qt platform plugin "linuxfb"
in "/work/qt/qt_arm".

Available platform plugins are: linuxfb, minimal, offscreen, vnc.

Reinstalling the application may fix this problem.
Aborted

这是因为没有找到linuxfb插件引起的,在QT的安装路径下:plugins/platforms,里面就存在libqlinuxfb.so,我把整个交叉编译过的QT复制到板子上,设置好环境变量:
vi /etc/profile

export QTEDIR=/work/qt/qt_arm
export LD_LIBRARY_PATH=/work/qt/qt_arm/lib:$LD_LIBRARY_PATH
#export QT_QPA_GENERIC_PLUGINS=tslib
#export QT_QPA_FONTDIR=$QTEDIR/lib/fonts
export QT_QPA_PLATFORM_PLUGIN_PATH=$QTEDIR/plugins/
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:size=176x220:mmSize=22x27:offset=0x0:
export QT_PLUGIN_PATH=/work/qt/qt_arm/plugins/

重启之后发现问题依旧没有解决,这样子,只好借助工具查看了!
使用strace:
如果是glibc的话可以从ubuntu下把starce拷出来放到板子上,就可以运行。
或者从网上下载一个别人编译好的strace,直接下载下来用,这里我也放一个下载链接吧,文章末尾提供。
或者是自己去下载strace源码来编译安装得到执行文件。

把strace放到板子根文件系统的bin目录即可。

起初是以为真的找不到linuxfb.so导致的错误,
执行:strace ./hello 2>&1 | grep “linuxfb.so
其中hello是我们的QT程序,发现:

lstat64("/work/qt/qt_arm/plugins/platforms/libqlinuxfb.so", {st_mode=S_IFREG|0755, st_size=721352, ...}) = 0
open("/work/qt/qt_arm/plugins/platforms/libqlinuxfb.so", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3

这表明是可以找到linuxfb.so的,并且成功打开了,那我们这个错误到底是什么呢?
直接执行:
strace ./hello
就会发现真正的错误是:

open("/work/qt/qt_arm/lib/libts-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No s                                                              uch file or directory)
open("tls/v7l/neon/vfp/libts-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such                                                               file or directory)
open("tls/v7l/neon/libts-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such fil                                                              e or directory)
open("tls/v7l/vfp/libts-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file                                                               or directory)
open("tls/v7l/libts-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or                                                               directory)
open("tls/neon/vfp/libts-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such fil                                                              e or directory)
open("tls/neon/libts-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or                                                               directory)
open("tls/vfp/libts-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or                                                               directory)
open("tls/libts-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or dire                                                              ctory)

也就是找不到libts-1.0.so.0
这个错误是因为,我交叉编译QT时,因为我没有触摸屏,所以我并没有管 libts 关于触摸这部分,所以导致不能找到libts-1.0.so.0。
最后我在交叉工具链上寻找libts-1.0.so
find -name libts-1.0.so
找到后拷到板子的lib目录下即可

下载链接:https://download.csdn.net/download/cuijianzhongswust/4113954
这是别人的链接,已编译为静态连接,直接把strace拷到/bin下即可使用

展开阅读全文

没有更多推荐了,返回首页