移植Qt5.12.9 for imx6ull

移植Qt5.12.9 for imx6ull(arm cortex-a7)

一、移植准备工作

  • 安装好交叉编译环境
  • 移植好tslib

二、编译Qt源码

1.下载并解压

使用wget下载源码

wget https://download.qt.io/archive/qt/5.12/5.12.9/single/qt-everywhere-src-5.12.9.tar.xz

解压压缩包

tar -Jxvf qt-everywhere-src-5.12.9.tar.xz

2.修改 qmake.conf

进入qt-everywhere-src-5.12.9目录

vi qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf

将以下内容替换原来的配置文件

#
# qmake configuration for building with arm-linux-gnueabi-g++
#

MAKEFILE_GENERATOR      = UNIX
CONFIG                 += incremental
QMAKE_INCREMENTAL_STYLE = sublib

QT_QPA_DEFAULT_PLATFORM = linuxfb
QMAKE_CFLAGS += -O2 -march=armv7-a -mtune=cortex-a7 -mfpu=neon -mfloat-abi=hard
QMAKE_CXXFLAGS += -O2 -march=armv7-a -mtune=cortex-a7 -mfpu=neon -mfloat-abi=hard

include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)

# modifications to g++.conf
QMAKE_CC = arm-linux-gnueabihf-gcc
QMAKE_CXX = arm-linux-gnueabihf-g++
QMAKE_LINK = arm-linux-gnueabihf-g++
QMAKE_LINK_SHLIB = arm-linux-gnueabihf-g++

# modifications to linux.conf
QMAKE_AR = arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY = arm-linux-gnueabihf-objcopy
QMAKE_NM = arm-linux-gnueabihf-nm -P
QMAKE_STRIP = arm-linux-gnueabihf-strip
load(qt_config)

3.生成Makefile文件,make编译

/home/lai/qt/qt-everywhere-src-5.12.9/arm-qt
/home/lai/linux/download/tool/tslib/include
/home/lai/linux/download/tool/tslib/lib
复制以下内容并将上面三个路径替换为自己对应的路径,然后生成Makefile

./configure -prefix /home/lai/qt/qt-everywhere-src-5.12.9/arm-qt -opensource -confirm-license -release -strip -shared -xplatform linux-arm-gnueabi-g++ -optimized-qmake -c++std c++11 --rpath=no -pch -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtconnectivity -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtlocation -skip qtmacextras -skip qtnetworkauth -skip qtpurchasing -skip qtremoteobjects -skip qtscript -skip qtscxml -skip qtsensors -skip qtspeech -skip qtsvg -skip qttools -skip qttranslations -skip qtwayland -skip qtwebengine -skip qtwebview -skip qtwinextras -skip qtx11extras -skip qtxmlpatterns -make libs -make examples -nomake tools -nomake tests -gui -widgets -dbus-runtime --glib=no --iconv=no --pcre=qt --zlib=qt  -no-openssl --freetype=qt --harfbuzz=qt  -no-opengl  -linuxfb --xcb=no  -tslib --libpng=qt --libjpeg=qt --sqlite=qt  -plugin-sql-sqlite  -I/home/lai/linux/download/tool/tslib/include  -L/home/lai/linux/download/tool/tslib/lib  -recheck-all

Makefile生成后,执行 make
编译完成后,执行 make install
然后查看生成的结果ls arm-qt

4.编译结果

编译结果输出文件

三、配置及运行测试

1.将生成arm-qt文件夹整体拷贝到目标板的/usr/lib目录

2.配置 Qt5 的环境变量

编辑/etc/profile,在末尾添加以下内容(我的触摸屏驱动是/dev/input/event2,你需要根据你的实际情况修改)。

export QT_ROOT=/usr/lib/arm-qt
export QT_QPA_GENERIC_PLUGINS=tslib:/dev/input/event2
export QT_QPA_FONTDIR=/usr/share/fonts
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
export QT_PLUGIN_PATH=$QT_ROOT/plugins
export LD_LIBRARY_PATH=$QT_ROOT/lib:$QT_ROOT/plugins/platforms
export QML2_IMPORT_PATH=$QT_ROOT/qml
export QT_QPA_FB_TSLIB=1

3.测试Qt运行

source /etc/profile
/usr/lib/arm-qt/examples/widgets/animation/animatedtiles/animatedtiles

在这里插入图片描述在这里插入图片描述

最后来张自己编译的。。。
开发板nfs挂载Ubuntu主机的源码目录,然后运行自己编译的可执行文件

mount -t nfs -o nolock 192.168.0.66:/home/lai/linux/nfs/code /mnt/nfs

在这里插入图片描述


总结

要想 Qt 支持触摸还需要编译 tslib,以生成触摸相关插件,/home/lai/linux/download/tool/tslib/include/home/lai/linux/download/tool/tslib/lib 指定了tslib的头文件目录和库文件目录。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值