Toybrick

RK3399搭建QT运行环境后,运行QTGUI程序失败的问题。

ymd

新手上路

积分
21
发表于 2022-1-6 11:24:51    查看: 2224|回复: 1 | [复制链接]    打印 | 显示全部楼层
瑞芯微的工程师们,您们好:
我是深圳一家企业的软件开发人员,最近我们公司有几款产品用到瑞芯微RK3399,硬件工程师已经设计好了电路板并正在调试硬件。我申请买了几块开发板,渠道是官网推荐的淘宝风火轮技术团队。我们打算在RK3399上跑一个QTUI程序,不涉及图像算法等。
拿到开发板我首先阅读了官方的wiki教程,ubootkernel都编译了一遍。然后我就开始安装QT环境,现在开发板的状态如下:
1. uboot:官方的uboot
2. Kernel: 官方的kernel   
3. Rootfs: 官方的rootfs,自己安装了一些程序,后面会提到  
4. Qt版本: 5.12.11
我搭建QT环境的过程,参考的是这篇博文: https://blog.csdn.net/xujiaofu6181/article/details/100599646
我在我的Ubuntu虚拟机上用QT创建了一个新的gui项目,只显示一个空白的mainwindow,用Ubuntu的gcc编译后可以运行,然后我使用交叉编译工具链编译它,具体的编译方法如下:
[size=12.0000pt]1. source /etc/profile | /opt/Qt5.12.11_arm/bin/qmake rk3399rundemo.pro -o Makefile -spec linux-aarch64-gnu-g++  DEFINES+=ARM
2. make
编译通过,得到一个rk3399rundemo的可执行程序,把它拷贝到开发板。开发板在上述搭建环境的过程中,已经改变了环境变量。如下 :
SHELL=/bin/bash
SUDO_GID=1000
SUDO_COMMAND=/bin/bash
SUDO_USER=toybrick
PWD=/home/toybrick/Desktop
LOGNAME=root
QT_ROOT=/opt/Qt5.12.11_arm
HOME=/root
LANG=C.UTF-8
LS_COLORS=
QT_QPA_PLATFORM=linuxfb:/dev/fb0
TERM=vt220
USER=root
SHLVL=1
LD_LIBRARY_PATH=/opt/Qt5.12.11_arm/lib:/opt/Qt5.12.11_arm/plugins/platforms
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
QT_QPA_PLATFORM_PLUGIN_PATH=/opt/Qt5.12.11_arm/plugins
SUDO_UID=1000
MAIL=/var/mail/root
QT_PLUGIN_PATH=/opt/Qt5.12.11_arm/plugins
QT_QPA_GENERIC_PLUGINS=tslib:/dev/input/event1:edevmouse:/dev/input/event3
OLDPWD=/home/toybrick
_=/usr/bin/env
执行程序有两种结果:
1. 开发板开机接了hdmi,登录了debian10,用命令行运行程序:
root@debian10:/home/toybrick/Desktop# ./rk3399rundemo
Failed to mmap framebuffer (Invalid argument)
linuxfb: Failed to initialize screen
No such plugin for spec "tslib:/dev/input/event1:edevmouse:/dev/input/event3"
no screens available, assuming 24-bit color
QFontDatabase: Cannot find font directory /opt/Qt5.12.11_arm/lib/fonts.
Note that Qt no longer ships fonts. Deploy some (from https://dejavu-fonts.github.io/ for example) or switch to fontconfig.
QFontDatabase: Cannot find font directory /opt/Qt5.12.11_arm/lib/fonts.
Note that Qt no longer ships fonts. Deploy some (from https://dejavu-fonts.github.io/ for example) or switch to fontconfig.
QFontDatabase: Cannot find font directory /opt/Qt5.12.11_arm/lib/fonts.
Note that Qt no longer ships fonts. Deploy some (from https://dejavu-fonts.github.io/ for example) or switch to fontconfig.
QFontDatabase: Cannot find font directory /opt/Qt5.12.11_arm/lib/fonts.
Note that Qt no longer ships fonts. Deploy some (from https://dejavu-fonts.github.io/ for example) or switch to fontconfig.
QFontDatabase: Cannot find font directory /opt/Qt5.12.11_arm/lib/fonts.
Note that Qt no longer ships fonts. Deploy some (from https://dejavu-fonts.github.io/ for example) or switch to fontconfig.
Cannot create window: no screens available
[ 2756.510358] Core dump to |/usr/lib/systemd/systemd-coredump 1750 0 0 6 1641438350 18446744073709551615 debian10.toybrick rk3399rundemo pipe failed
Aborted
程序闪退了。
2. 开发板开机没接hdmi,用命令行运行程序:
root@debian10:/home/toybrick/Desktop# ./rk3399rundemo
QFontDatabase: Cannot find font directory /opt/Qt5.12.11_arm/lib/fonts.
Note that Qt no longer ships fonts. Deploy some (from https://dejavu-fonts.github.io/ for example) or switch to fontconfig.
QFontDatabase: Cannot find font directory /opt/Qt5.12.11_arm/lib/fonts.
Note that Qt no longer ships fonts. Deploy some (from https://dejavu-fonts.github.io/ for example) or switch to fontconfig.
QFontDatabase: Cannot find font directory /opt/Qt5.12.11_arm/lib/fonts.
Note that Qt no longer ships fonts. Deploy some (from https://dejavu-fonts.github.io/ for example) or switch to fontconfig.
QFontDatabase: Cannot find font directory /opt/Qt5.12.11_arm/lib/fonts.
Note that Qt no longer ships fonts. Deploy some (from https://dejavu-fonts.github.io/ for example) or switch to fontconfig.
QFontDatabase: Cannot find font directory /opt/Qt5.12.11_arm/lib/fonts.
Note that Qt no longer ships fonts. Deploy some (from https://dejavu-fonts.github.io/ for example) or switch to fontconfig.
程序可以一直运行,exec()中,直到手动退出。
为了验证是不是显示的问题,我用QT新建了一个console程序,放到开发板上执行,能正常输出打印没有闪退。

我上网查资料,发现有一个这样的回答:"我当时用的RK3399,他文件系统里面自己运行着一个一个显示插件的可执行程序wayland,后来把这个进程kill掉就好了;"
照做还是不起作用。
请问,有官方的QT安装教程吗,GUI程序运行不起来,问题出在哪?

回复

使用道具 举报

hjainibuli

新手上路

积分
32
发表于 2022-1-8 22:15:51 | 显示全部楼层
我直接在rk3399板子上编译成功了qt环境,参考了这篇帖子https://blog.csdn.net/qqwangfan/article/details/84964856,注意一下,帖子中的qt版本我编译失败了,我编译成功的qt版本是5.15.2
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

产品中心 购买渠道 开源社区 Wiki教程 资料下载 关于Toybrick


快速回复 返回顶部 返回列表