QT4.5.3在海思3520A上移植步骤-修订版
2015年3月29日星期日, 16:59:03
1.首先要保证已经安装了海思的交叉编译器;
#arm-hi + Tab key to show which toolchainhave been installed
[root@roger]#arm-hi
arm-hisiv100nptl-linux-addr2line arm-hisiv100nptl-linux-gprof
arm-hisiv100nptl-linux-ar arm-hisiv100nptl-linux-ld
arm-hisiv100nptl-linux-as arm-hisiv100nptl-linux-nm
arm-hisiv100nptl-linux-c++ arm-hisiv100nptl-linux-objcopy
arm-hisiv100nptl-linux-c++filt arm-hisiv100nptl-linux-objdump
arm-hisiv100nptl-linux-cpp arm-hisiv100nptl-linux-ranlib
arm-hisiv100nptl-linux-g++ arm-hisiv100nptl-linux-readelf
arm-hisiv100nptl-linux-gcc arm-hisiv100nptl-linux-size
arm-hisiv100nptl-linux-gcc-4.4.1 arm-hisiv100nptl-linux-strings
arm-hisiv100nptl-linux-gccbug arm-hisiv100nptl-linux-strip
arm-hisiv100nptl-linux-gcov
2.下载qt-embedded-linux-opensource-src-4.5.3;
下载地址:
2.1 官网地址:
ftp://ftp.qt.nokia.com/qt/source/qt-embedded-linux-opensource-src-4.5.3.tar.gz
3.更改qt-embedded-linux-opensource-src-4.5.3/mkspecs/qws/linux-arm-g++/qmake.conf如下
include(../../common/g++.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)
# modificationsto g++.conf
#arm-hi + Tab key to show which toolchainhave been installed
CCHEAD?= arm-hisiv100nptl-linux-
QMAKE_CC = $(CCHEAD)gcc
QMAKE_CXX =$(CCHEAD)g++
QMAKE_LINK =$(CCHEAD)g++
QMAKE_LINK_SHLIB = $(CCHEAD)g++
#modifications to linux.conf
QMAKE_AR = $(CCHEAD)ar cqs
QMAKE_OBJCOPY =$(CCHEAD)objcopy
QMAKE_STRIP = $(CCHEAD)strip
load(qt_config)
4.配置qt-embedded-linux-opensource-src-4.5.3
cd qt-embedded-linux-opensource-src-4.5.3
./configure -embedded arm \
-qt-libpng \
-qt-libjpeg \
-qt-libtiff \
-qt-libmng \
-qt-gif \
-qt-zlib \
-fast \
-no-webkit \
-nomake examples \
-nomake demos \
-static \
-little-endian\
--prefix=/usr/local/qt-4.5.3
其中 --prefix是编译QT后要安装的路径,可以根据自己实际情况更改。
5.编译QT库 -- 此处较为耗时,大概30min
gmake
6. 安装QT库
gmake install
7.更改虚拟机的环境变量
export QMAKESPEC=/usr/local/qt-4.5.3/mkspecs/qws/linux-arm-g++
export PATH="/usr/local/qt-4.5.3/bin":$PATH
要根据实际情况更改上边的2个环境变量。/usr/local/qt-4.5.3是自定义的QT的安装路径
8.检查QT环境变量是否设置成功。
输入 which qmake 后显示路径应该是QT安装目录里的qmake.
[root@rogerqt-4.5.3]# which qmake
/usr/local/qt-4.5.3/bin/qmake
9.qt 库安装完成。
==========================================================================
安装过程中的相关出错信息:
1、
g++ -c -pipe -fno-exceptions -O2 -Wall -W -D_REENTRANT -fPIC -DQT_BUILD_CORE_LIB -DQT_NO_USING_NAMESPACE -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT3_SUPPORT -DQT_MOC_COMPAT -DHB_EXPORT=Q_CORE_EXPORT -DQT_NO_DEBUG -I../../mkspecs/qws/linux-x86-g++ -I. -I../../include -I../../include/QtCore -I.rcc/release-static-emb-arm -Iglobal -I../3rdparty/zlib -I../3rdparty/harfbuzz/src -I.moc/release-static-emb-arm -o .obj/release-static-emb-arm/qfutureinterface.o concurrent/qfutureinterface.cpp {standard input}: Assembler messages: {standard input}:407: Error: no such instruction: `swpb %cl,%al,[%esi]' {standard input}:420: Error: no such instruction: `swpb %al,%dil,[%esi]' {standard input}:431: Error: no such instruction: `swpb %cl,%al,[%esi]' {standard input}:1025: Error: no such instruction: `swpb %cl,%al,[%esi]' . . . . . . {standard input}:6283: Error: no such instruction: `swpb %cl,%al,[%edi]' {standard input}:6296: Error: no such instruction: `swpb %al,%sil,[%edi]' {standard input}:6307: Error: no such instruction: `swpb %cl,%al,[%edi]' gmake[1]: *** [.obj/release-static-emb-arm/qfutureinterface.o] 错误 1 gmake[1]: Leaving directory `/root/Download/qt-embedded-linux-opensource-src-4.5.3/src/corelib' gmake: *** [sub-corelib-make_default-ordered] 错误 2 [root@roger qt-embedded-linux-opensource-src-4.5.3]#
检索 Log信息 发现: 交叉编译工具链的名称写错了, 修正后即可;
2、
The target system byte order could not be detected! Turn on verbose messaging (-v) to see the final report. You can use the -little-endian or -big-endian switch to ./configure to continue.
根据提示信息 可知: 未指定 大小端 模式, 指定 -little-endian 即可;
/* 测试 大小端 模式 Sample, 编译执行文件 到目标机运行即可 */ #include "stdio.h" int main() { union w { int a; //4 bytes char b; //1 byte } c; c.a=1; if (c.b==1) printf("It is Little_endian!\n"); else printf("It is Big_endian!\n"); return 1; }
Step 4:
# ./configure -embedded arm -qt-libpng -qt-libjpeg -qt-libtiff -qt-libmng -qt-gif -qt-zlib -fast -no-webkit -nomake examples -nomake demos-little-endian -static --prefix=/usr/local/qt-4.5.3