1.下载Qt源码http://download.qt.io/archive/qt/5.2/5.2.1/single/
2.安装海思SDK,编译链,参考海思文档。
3.解压qt-everywhere-opensource-src-5.2.1.tar.gz
4.创建qmake.conf,设置交叉编译工具链
a.进入/qt-everywhere-opensource-src-5.2.1/qtbase/mkspecs
b.cp linux-arm-gnueabi-g++/ linux-hisi-g++ -rf
c.修改qmake.conf(本项目使用的交叉编译链工具是arm-hisiv500-linux-g++)
d.修改如下:
#
# qmake configuration for building with arm-linux-gnueabi-g++
#
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental gdb_dwarf_index
QMAKE_INCREMENTAL_STYLE = sublib
QT_QPA_DEFAULT_PLATFORM = linuxfb
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-hisiv500-linux-gcc
QMAKE_CXX = arm-hisiv500-linux-g++
QMAKE_LINK = arm-hisiv500-linux-g++
QMAKE_LINK_SHLIB = arm-hisiv500-linux-g++
# modifications to linux.conf
QMAKE_AR = arm-hisiv500-linux-ar cqs
QMAKE_OBJCOPY = arm-hisiv500-linux-objcopy
QMAKE_NM = arm-hisiv500-linux-nm -P
QMAKE_STRIP = arm-hisiv500-linux-strip
load(qt_config)
说明1:QT_QPA_DEFAULT_PLATFORM选项是指定图形插件, Qt5将各平台底层抽象为一个 qpa 插件,
通常在mac上是cocoa, 在window上是windows, 在linux X11下是xcb, 如果有OPENGL支持, 那么选eglfs。而对于无硬件加速的设备,则选择linuxfb,。
minimal仅仅是让程序跑通, 不起任何作用
说明2:目标板为海思3521D,cpu为ARM Cortex A7 双核
5.configrue配置 (可以通过./configure -help来查询自己所要添加删除的项)
./configure -prefix /home/3521dWork/qt/hisi_qt -release -opensource -xplatform linux-hisi-g++ -nomake tests -nomake examples -no-largefile -no-sql-sqlite -no-sql-sqlite2 -skip qtdeclarative -qt-zlib -no-nis -qt-libpng -qt-libjpeg -qt-freetype
注:1.中间会出现fatal error: gnu/lib-names.h: No such file or directory错误,哪里错了,注释哪里。
2.ERROR: Unknown module(s) in QT: quick ,在./configure脚本中加上-skip qtdeclarative
6.make
7.make install