您的位置:首页 > 运维架构 > Linux

QT4.6.2植移(arm-linux-gcc3.4.1)

2012-02-10 15:49 316 查看
由于板子上的glibc库还有其他程序,都是使用的arm-linux-gcc3.4.6编译的,所以我不得不放弃原来的arm-linux-gcc4.3.2改用3.4.6版本的,另外一点重要的原因是我使用4.3.2交叉编译的程序无法再板子上运行,glibc库版本不一致,所以我今天又重新使用3.4.6交叉编译QTE4.6.3并移植,配置ubuntu 10.04编译环境

安装g++:

sudo apt-get g++

安装编译X11用到的库:

sudo apt-get -y install x-dev libx11-dev xlibs-static-dev x11proto-xext-dev libxext-dev libqt3-mt-dev

安装libxtst-dev:

sudo apt-get install libxtst-dev

2.3 建立目录

/usr/local/qt (源码包存放的目录)

在终端中执行:

mkdir /usr/local/qt

3 安装交叉编译器

使用“博创”提供的arm-linux-gcc-3.4.6

3.1 解压arm-linux-gcc-3.4.6.tgz

把arm-linux-gcc-3.4.6.tgz复制到建立的目录/usr/local/qt下,在终端中进行如下操作:

cd /usr/local/qt

sudo tar xvzf arm-linux-gcc-3.4.6.tgz –C /usr/local/

注意:C 后面有个空格,并且 C 是大写的,它是英文单词“Change”的第一个字母,在此是改变目录的意思。

执行该命令,将把 arm-linux-gcc 安装到/usr/loca/ 目录。

3.2 设置路径变量

由于刚才是在/usr/local/arm的目录下安装的arm-linux-gcc-3.4.6,所以设置路径为:

-1-

PATH=/usr/local/arm/3.4.6/bin:$PATH,然后可以查看arm-linux-gcc的版本情况,在终端中进行以下操作:

export PATH=/usr/local/arm/3.4.6/bin:$PATH

arm-linux-gcc -v

这样就把交叉编译器的地址变量设置好了,但这样设置路径变量的方法只在此终端中生效,对其他的终端无效,若要设置对所有用户所有终端都有效的路径变量,在/etc/profile 中最后一行添加“export PATH=/usr/local/arm/3.4.6/bin:$PATH”,保存退出,注销系统即生效。

解压qt文件

将qt-everywhere-opensource-src-4.6.3.tar.gz复制到/usr/local/qt目录下进行解压,解压完成后,得到/usr/local/qt/qt-everywhere-opensource-src-4.6.3目录。将qt-everywhere-opensource-src-4.6.3重命名为qt-everywhere-opensource-src-4.6.3-arm.

在终端中进行操作:

cd /usr/local/qt

tar zxvf qt-everywhere-opensource-src-4.6.3.tar.gz

mv qt-everywhere-opensource-src-4.6.3 qt-everywhere-opensource-src-4.6.3-arm

解压及编译触摸屏软件tslib1.4.tar.gz

A、安装编译过程需用到的程序

apt-get install autoconf(或autoconf2.13)

apt-get install automake

apt-get install libtool

B、配置编译

tar xzvf tslib-1.4.tar.gz

cd tslib1.4

#vi build.sh

修改该脚本文件为如下:

#/bin/sh

export CC=arm-linux-gcc

./autogen.sh

echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache

./configure --host=arm-linux --cache-file=arm-linux.cache -prefix=/usr/local/tslib

make

make install

推出保存后编译:

#./build.sh

3、编译QT/E库

#cd /usr/local/qt/qt-everywhere-opensource-src-4.6.3-arm

#cp -a /usr/localtslib/lib/* qt-everywhere-opensource-src-4.6.3-arm/lib/

#cp -a /usr/local/tslib/include/ts* qt-everywhere-opensource-src-4.6.3-arm/include/

QTE/configure时的参数

./configure -qt-kbd-tty -qt-gfx-linuxfb -no-gfx-transformed -no-gfx-multiscreen -qt-mouse-pc -no-gfx-qvfb -no-gfx-vnc -qt-kbd-tty -qt-gfx-linuxfb -no-gfx-qvfb -no-gfx-vnc -qt-mouse-tslib -no-glib -prefix /usr/local/Trolltech/QtE4.6.3-arm -embedded arm -release
-shared -fast -no-largefile -qt-sql-sqlite -no-qt3support -no-xmlpatterns -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -no-webkit -qt-zlib -qt-gif -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -make libs -nomake tools -nomake examples -nomake docs -nomake demo
-no-nis -no-cups -no-iconv -no-dbus -no-openssl -xplatform qws/linux-arm-g++ -little-endian -qt-freetype -depths 16,18 -I/usr/local/tslib/include -L/usr/local/tslib/lib

使用4.3.2交叉编译器基本上没出现什么错误,但是使用3.4.6刚开始编译出现了以下错误:text/qfontengine_ft.cpp: In member function `bool QFontEngineFT::init(QFontEngine::FaceId, bool, QFontEngineFT::GlyphFormat)':

text/qfontengine_ft.cpp:696: warning: converting to `int' from `qreal'

{standard input}: Assembler messages:

{standard input}:781: Error: register or shift expression expected -- `orr r3,r2,lsl#16'

{standard input}:792: Error: register or shift expression expected -- `orr r2,r3,lsl#16'

{standard input}:7752: Error: register or shift expression expected -- `orr r3,r0,lsl#16'

{standard input}:7765: Error: register or shift expression expected -- `orr r1,r0,lsl#16'

make[1]: *** [.obj/release-shared-emb-arm/qfontengine_ft.o] 错误 1

make[1]:正在离开目录 `/usr/local/qt/qt-everywhere-opensource-src-4.6

苦思不得其解,最后还是上网查了查,发现解决方法为:

把~/qt-everywhere-opensource-src-4.6.0/src/3rdparty/freetype/include/freetype/config/ftconfig.h 这个文件的第330行改一下

原来是:

"orr %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */

改成:

"orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */

这个问题解决了,删除原来的目录重新解压继续编译,又出现以下错误:../3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:298:6: #error "Not supported ARM architecture"

make[1]: *** [obj/release/pcre_compile.o] 错误 1

make[1]:正在离开目录 `/usr/local/qt/qt-everywhere-opensource-src-4.6.3-arm/src/script'

make: *** [sub-script-make_defaulrgefile

解决方法:add a line in your ./configure parameters, such as "-D__ARM_ARCH_5TEJ__" , or whichever architecture definition that suits the platform.

就是在./configure参数后面增加一个"-D__ARM_ARCH_5TEJ__"

所以前面的配置参数应该为./configure -qt-kbd-tty -qt-gfx-linuxfb -no-gfx-transformed -no-gfx-multiscreen -qt-mouse-pc -no-gfx-qvfb -no-gfx-vnc -qt-kbd-tty -qt-gfx-linuxfb -no-gfx-qvfb -no-gfx-vnc -qt-mouse-tslib -no-glib -prefix /usr/local/Trolltech/qte4.6.3-arm
-embedded arm -release -shared -fast -no-largefile -qt-sql-sqlite -no-qt3support -no-xmlpatterns -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -no-webkit -qt-zlib -qt-gif -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -make libs -nomake tools -nomake examples
-nomake docs -nomake demo -no-nis -no-cups -no-iconv -no-dbus -no-openssl -xplatform qws/linux-arm-g++ -little-endian -qt-freetype -depths 16,18 -I/usr/local/tslib/include -L/usr/local/tslib/lib -v -D__ARM_ARCH_5TEJ__

继续编译没有什么错误了,然后make install

最后是cp lib和字体,以及设置环境变量。到这里移植先告一段落!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: