菜鸟学习中······
分类: LINUX
2013-08-21 11:49:53
qte4.7.1-arm平台交叉编译环境搭建法
1、 下载交叉编译器
2、 解压编译器:#tar –zxvf gcc-4.1.2-glibc-2.5-nptl-3.tar.gz
3、 创建目录 #mkdir /opt/freescale/usr/local
4、 将2中解压的编译器考到3中目录下
5、 下载
6、 进入root用户,创建目录,把qt压缩包解压到此目录下,改名为qt-everywhere-opensource-src-4.7.1-arm
#sudo su
#mkdir usr/local/arm
#tar -zxvf qt-everywhere-opensource-src-4.7.1.tar.gz usr/local/arm
#mv -r qt-everywhere-opensource-src-4.7.1 qt-everywhere-opensource-src-4.7.1-arm
7、默认情况下系统是没有g++编译环境的。需要手动安装。执行sudo apt-get install build-essential。
8、执行sudo apt-get install libx11-dev libfreetype6-dev libavahi-gobject-dev libSM-dev libXrender-dev libfontconfig-dev libXext-dev
9、export PATH=$PATH:/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/——配置环境变量,把上面的交叉编译器配置到环境变量中
10、配置usr/local/arm/ qt-everywhere-opensource-src-4.7.1-arm/ mkspecs/ qws/ linux-arm-g++中的qmake.conf文件。
文件原内容:
# qmake configuration for building with arm-linux-g++
#
include(../../common/g++.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)
# modifications to g++.conf
QMAKE_CC = arm-linux-gcc
QMAKE_CXX = arm-linux-g++
QMAKE_LINK = arm-linux-g++
QMAKE_LINK_SHLIB = arm-linux-g++
# modifications to linux.conf
QMAKE_AR = arm-linux-ar cqs
QMAKE_OBJCOPY = arm-linux-objcopy
QMAKE_STRIP = arm-linux-strip
load(qt_config)
修改后内容:
# qmake configuration for building with arm-linux-g++
#
include(../../common/g++.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)
# modifications to g++.conf
QMAKE_CC =/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc
QMAKE_CXX =/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-g++
QMAKE_LINK =/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-g++
QMAKE_LINK_SHLIB =/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-g++
# modifications to linux.conf
QMAKE_AR = /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ar cqs
QMAKE_OBJCOPY = /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-objcopy
QMAKE_STRIP = /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-strip
load(qt_config)
9、配置环境——安装
#cd qt-embedded-linux-opensource-src-4.5.2-arm
#./configure -prefix /usr/local/Trolltech/QtEmbedded-4.7.1-arm -embedded arm -little-endian -xplatform qws/linux-arm-g++
#make (可用make confclean卸载)
#make install
编译完后,qt-embedded-arm被安装在/usr/local/Trolltech/QtEmbedded-4.5.2-arm下。
////////////////////////////////////////////////////////////////////////////////////////////
编译错误1:
#./configure -prefix
/usr/local/Trolltech/QtEmbedded-4.5.2-arm -embedded arm -xplatform
qws/linux-arm-g++
在这里编译器报错:
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编译通过。LITTLE-ENDIAN(小字节序、低字节序)。 与之对应的是:BIG-ENDIAN(大字节序、高字节序)
////////////////////////////////////////////////////////////////////////////////////////////
编译错误2:
make: Nothing to be done for `first'.
Basic XLib functionality test failed!
You might need to modify the include and library search paths by editing
QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in /usr/local/arm/qt-everywhere-opensource-src-4.7.1-arm/mkspecs/qws/linux-arm-g++.
安装libxtst-dev,重新编译。sudo apt-get install libxtst-dev
///////////////////////////////////////////////////////////////////////////////////////////////
编译错误3:
arm-linux-g++: Command not found
修改qmake.conf中的g++.conf
////////////////////////////////////////////////////////////////////////////////////////////////
编译错误4:
:make[1]:
make[1]: *** [release/libjscore.a] Error 127
make[1]: Leaving directory `/usr/local/arm/qt-everywhere-opensource-src-4.7.1/src/3rdparty/webkit/JavaScriptCore'
make: *** [sub-javascriptcore-make_default-ordered] Error 2
修改qmake.conf中的linux.conf
////////////////////////////////////////////////////////////////////////////////////////////////