运行QT程序报错 is an invalid ELF object

运行QT程序报错 is an invalid ELF object

首先上报错log

root@TinaLinux:/# cd usr/share/qt5/examples/gui/analogclock/
root@TinaLinux:/usr/share/qt5/examples/gui/analogclock# ./analogclock 
QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/qt5/plugins" ...
QFactoryLoader::QFactoryLoader() checking directory path "/usr/share/qt5/examples/gui/analogclock" ...
QFactoryLoader::QFactoryLoader() looking at "/usr/share/qt5/examples/gui/analogclock/analogclock"
QElfParser: '/usr/share/qt5/examples/gui/analogclock/analogclock' is an invalid ELF object (shstrtab section header seems to be at 0)
"'/usr/share/qt5/examples/gui/analogclock/analogclock' is an invalid ELF object (shstrtab section header seems to be at 0)" 
         not a plugin
QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/qt5/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt5/plugins/platforms/libqeglfs.so"
QElfParser: '/usr/lib/qt5/plugins/platforms/libqeglfs.so' is an invalid ELF object (shstrtab section header seems to be at 0)
"'/usr/lib/qt5/plugins/platforms/libqeglfs.so' is an invalid ELF object (shstrtab section header seems to be at 0)" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt5/plugins/platforms/libqlinuxfb.so"
QElfParser: '/usr/lib/qt5/plugins/platforms/libqlinuxfb.so' is an invalid ELF object (shstrtab section header seems to be at 0)
"'/usr/lib/qt5/plugins/platforms/libqlinuxfb.so' is an invalid ELF object (shstrtab section header seems to be at 0)" 
         not a plugin
QFactoryLoader::QFactoryLoader() checking directory path "/usr/share/qt5/examples/gui/analogclock/platforms" ...
This application failed to start because it could not find or load the Qt platform plugin "linuxfb"
in "/usr/lib/qt5/plugins".

Reinstalling the application may fix this problem.
Aborted

在目录/usr/lib/qt5/plugins/platforms/下的确是有libqeglfs.so和libqlinuxfb.so文件的,但是报错说是一个无效的ELF对象,推断可能是so文件损坏了,把编译出来的libqeglfs.so与libqlinuxfb.so使用adb push再次推送到小机端,程序执行成功。

常用QT5 环境变量

#export QT_QPA_PLATFORM=eglfs:size=800x480
#export FRAMEBUFFER=/dev/fb1
export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/qt5/plugins
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:size=800x480:mmSize=800x480:offset=0x0:tty=/dev/tty1
export QT_QPA_FONTDIR=/usr/lib/fonts
export QT_QPA_GENERIC_PLUGINS=tslib
export QT_QPA_GENERIC_PLUGINS=evdevmouse:/dev/input/mouse0
export QT_QPA_GENERIC_PLUGINS=evdevkeyboard:/dev/input/event2
export QT_DEBUG_PLUGINS=1
export QT_LOGGING_RULES=qt.qpa.input=true
变量 说明
QT_QPA_PLATFORM QT运行的平台,有eglfs,linuxfb,wayland等等
QT_QPA_PLATFORM_PLUGIN_PATH 平台的插件路径
QT_QPA_FONTDIR 需要加载字体的路径
QT_QPA_GENERIC_PLUGINS 指定使用的触摸库,输入设备
QT_DEBUG_PLUGINS 是否打开QT调试功能
QT_LOGGING_RULES 日志记录规则
FRAMEBUFFER 可以指定使用的fb设备
发布了30 篇原创文章 · 获赞 28 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/anyuliuxing/article/details/79203439