(本文作个人备忘之用,转载请注明出处)

一、安装 arm-linux-gcc 3.4.1

下载 arm-linux-gcc-3.4.1.tar.bz2

解压缩 sudo tar -xjvf arm-linux-gcc-3.4.1.tar.bz2 -C /

修改 /root/.bashrc 末尾加入:export PATH=/usr/local/arm/3.4.1/bin:$PATH

修改 ~/.bashrc 末尾加入:export PATH=/usr/local/arm/3.4.1/bin:$PATH

(注:环境变量的修改也可在 /etc/bash.bashrc 中一次性完成)

注销,重新登录


二、安装 qt-embedded 4.5(交叉编译需在超级管理员下执行)

解压缩 qt-embedded-linux-opensource-src-4.5.0.tar.gz 至任意目录

修改(触摸屏问题):qt-embedded-linux-opensource-src-4.5.0/src/gui/embedded/qmouselinuxtp_qws.h 开头加入

    #define QT_QWS_IPAQ

    #define QT_QWS_IPAQ_RAW
   
    出错原因:在另一个源文件 qmouselinuxtp_qws.cpp 里应把 /dev/h3600_ts 替换为自己板子的设备文件,实验室的板子的设备为 /dev/h3600_tsraw,如果只定义了 QT_QWS_IPAQ 则使用的是 /dev/h3600_ts,如果两个都定义了则使用的是 /dev/h3600_tsraw

修改:qt-embedded-linux-opensource-src-4.5.0/src/corelib/global/qlibraryinfo.cpp

    开头加入 #include <stdio.h>
   
    #define sysexit(c) __builtin_exit(c) 修改为 #define sysexit(c) exit(c)
   
    出错原因:Maybe the configure script should try to compile an example with __builtin_exit(x) to determine if it's available or not, and if it's not available a proper macro should be defined so that the simple exit() function is used instead.
   
    译文:configure 脚本可能会尝试运行一个含有退出函数 __builtin_exit(x) 的例子,以确定(此Qt版本)是否可用,如果不可用,那么应该定义一个恰当的宏,因此,我们用简单的 exit() 函数代替了它。

运行:./configure -qt-sql-sqlite -xplatform qws/linux-arm-g++ -webkit -qt-mouse-linuxtp -embedded arm

运行:make(此编译过程将持续 3~4 小时)

运行:make install

修改 /root/.bashrc 末尾加入:export PATH=/usr/local/Trolltech/QtEmbedded-4.5.0-arm/bin:$PATH

修改 ~/.bashrc 末尾加入:export PATH=/usr/local/Trolltech/QtEmbedded-4.5.0-arm/bin:$PATH

注销,重新登录


三、安装 qt-embedded 4.6(交叉编译需在超级管理员下执行)

解压缩 qt-everywhere-opensource-src-4.6.2.tar.gz 至任意目录

修改(触摸屏问题):qt-everywhere-opensource-src-4.6.2/src/gui/embedded/qmouselinuxtp_qws.h 开头加入

    #define QT_QWS_IPAQ

    #define QT_QWS_IPAQ_RAW

修改:qt-everywhere-opensource-src-4.6.2/src/corelib/global/qlibraryinfo.cpp

    开头加入 #include <stdio.h>

修改(汇编问题):qt-everywhere-opensource-src-4.6.2/src/3rdparty/freetype/include/freetype/config/ftconfig.h

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

    "orr    %0, %0, %2, lsl #16\n\t"  /* %0 |= %2 << 16 */
   
    出错原因:(汇编问题,尚不明确)

运行:./configure -qt-sql-sqlite -xplatform qws/linux-arm-g++ -webkit -qt-mouse-linuxtp -embedded arm -D__ARM_ARCH_5TEJ__

    添加选项 -D__ARM_ARCH_5TEJ__ 的原因:此版本(qt-everywhere)中必须明确指定目标体系结构(Target Architecture),对体系结构的定义可参照 qt-everywhere-opensource-src-4.6.2/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h

运行:make(此编译过程将持续 3~4 小时)

运行:make install

修改 /root/.bashrc 末尾加入:export PATH=/usr/local/Trolltech/QtEmbedded-4.6.2-arm/bin:$PATH

修改 ~/.bashrc 末尾加入:export PATH=/usr/local/Trolltech/QtEmbedded-4.6.2-arm/bin:$PATH

注销,重新登录