移植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的头文件目录和库文件目录。

2万+

被折叠的 条评论
为什么被折叠?



