准备工作

  • 下载Debian11镜像
  • 安装VM Player
  • 安装系统

下载 gnueabihf

  • 1 download gcc-linaro-4.9.4-2017.01-i686_arm-linux-gnueabihf.tar.xz
  • 2 download gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf.tar.xz
  • 将bin配置到 path

下载qt5.12.19 编译arm

 
1. build  step

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
cd qt-everywhere-src-5.12.9


<!-- more -->


#修改配置文件
vim 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)


# 编译

./configure -prefix /home/debian/tools/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 --libpng=qt --libjpeg=qt --sqlite=qt  -plugin-sql-sqlite -recheck-all


gmake -j16
gmake install

#将生成armqt文件夹整体拷贝到目标板的/usr/lib目录

export QT_ROOT=/usr/lib/armqt
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

执行程序

qt配置截图

  • 配置qmake
  • 配置gcc g++
  • 配置armbuild 项