开发包

  • arm-2014.05 : ARM交叉编译器
  • tslib1.4 :通用触摸屏驱动
  • qt-everywhere-opensource-src-5.9.6.tar.xz : Qt5.9.6源码

开发机环境配置

1、配置交叉编译器环境

  1. 解压arm-2014.05.tar.gz/user/local/arm/ 目录下

  2. 添加路径到环境变量。修改(系统环境变量)/etc/profile 或者(用户环境变量)~/.bashrc,修改完成以后,执行source /etc/profilesource ~/.bashrc

    1
    export PATH=$PATH:/usr/local/arm/arm-2014.05/bin

  3. 添加到环境变量以后,在命令行窗口内输入arm并连续按2次 Tab 键,如果出现以下内容,则环境配置正确。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    xxxx@xxxx-pc:~$ arm
    arm2hpdl arm-none-linux-gnueabi-gcc-nm
    arm-none-linux-gnueabi-addr2line arm-none-linux-gnueabi-gcc-ranlib
    arm-none-linux-gnueabi-ar arm-none-linux-gnueabi-gcov
    arm-none-linux-gnueabi-as arm-none-linux-gnueabi-gdb
    arm-none-linux-gnueabi-c++ arm-none-linux-gnueabi-gprof
    arm-none-linux-gnueabi-c++filt arm-none-linux-gnueabi-ld
    arm-none-linux-gnueabi-cpp arm-none-linux-gnueabi-nm
    arm-none-linux-gnueabi-cs arm-none-linux-gnueabi-objcopy
    arm-none-linux-gnueabi-cs-daemon arm-none-linux-gnueabi-objdump
    arm-none-linux-gnueabi-elfedit arm-none-linux-gnueabi-ranlib
    arm-none-linux-gnueabi-g++ arm-none-linux-gnueabi-readelf
    arm-none-linux-gnueabi-gcc arm-none-linux-gnueabi-size
    arm-none-linux-gnueabi-gcc-4.8.3 arm-none-linux-gnueabi-strings
    arm-none-linux-gnueabi-gcc-ar arm-none-linux-gnueabi-strip

2、 编译tslib

参考 QT5.7交叉编译安装到arm

3、编译Qt源码

3.1 构建自动编译脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
./configure \
-release \
-opensource \
-confirm-license \
-prefix /opt/Qt5.9.6_arm \
-xplatform linux-arm-gnueabi-g++ \ #编译平台与下面的qmake所在文件夹应相同
-no-opengl \
-c++std c++11 \
-no-dbus \
-nomake examples \
-nomake tests \
-tslib \
-skip qtpurchasing \
-I/opt/tslib1.4/include -L/opt/tslib1.4/lib

3.2 修改qmake

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

修改文档内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#
# qmake configuration for building with arm-linux-gnueabi-g++
#

MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib

QT_QPA_DEFAULT_PLATFORM = linux #eglfs
QMAKE_CFLAGS_RELEASE += -O2 -march=armv7-a
QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv7-a

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

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

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

4、编译帮助文档

1
2
make docs
nmake install_docs

5、配置Qt环境

参考 QT5.7交叉编译安装到arm


Qt交叉编译参考文档: