Linux系统是完全安装RedHat9.0,板子是hybus的X-Hyper250B的,Toolchain用的是开发板带的hybus-arm-linux-R1.1(库的版本是2.95.3)
交叉编译所用到的文件:(所有文件都放在/usr/local/下面)
qt-embedded-2.3.10-free.tar.gz
qt-x11-2.3.2.tar.gz
qtopia-free-source-2.1.1.tar.gz
tmake-1.13.tar.gz
e2fsprogs-1.35.tar.gz
l主机x86的编译步骤:
tar xfz qt-embedded-2.3.10-free.tar.gz(解压后qt-2.3.10改名为qt-2.3.10-host)
export QTEDIR=$PWD/qt-2.3.10-host
tar xfz qt-x11-2.3.2.tar.gz(解压后为qt-2.3.2)
export QT2DIR=$PWD/qt-2.3.2
tar xfz qtopia-free-source-2.1.1.tar.gz(解压后qtopia-free-2.1.1改名为qtopia-2.1.1-host)
export QPEDIR=$PWD/qtopia-2.1.1-host
tar xfz tmake-1.13.tar.gz(解压后tmake-1.13)
export TMAKEDIR=$PWD/tmake-1.13
export TMAKEPATH=$PWD/tmake-1.13/lib/qws/linux-x86-g++
export PATH=$TMAKEDIR/bin:$PATH
cd qt-2.3.2
export QTDIR=$QT2DIR
export PATH=$QTDIR/bin:$PATH
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
./configure -no-xft
make
make -C tools/qvfb
cd ..
cd qt-2.3.10-host
export QTDIR=$PWD
export PATH=$QTDIR/bin:$PATH
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
mkdir bin (因为解压后的qt-2.3.10没有bin文件夹)
cp $QT2DIR/bin/uic bin
cp $QT2DIR/tools/qvfb/qvfb bin
cp $QPEDIR/src/qt/qconfig-qpe.h src/tools/
./configure -qconfig qpe -qvfb -thread -system-jpeg -gif -depths 4,8,16,32
make
cd ..
tar xzf e2fsprogs-1.35.tar.gz
cd e2fsprogs-1.35
./configure -enable-elf-shlibs
make install lib/uuid/
注:这是编译x86的libuuid库
cd ..
cd qtopia-2.1.1-host
export PATH=$QPEDIR/bin:$PATH
export LD_LIBRARY_PATH=$QPEDIR/lib:$LD_LIBRARY_PATH
./configure
make
编译例子:(注意:环境变量要按照上面export设置)
$qmake -project ==>>我都是这样创建.pro文件的
$tmake -o Makefile hello.pro
$make
$qvfb &
$./hello -qws 或者$qpe
还没怎么仔细研究过qpe。
l 目标机arm的编译步骤:
tar xfz qt-embedded-2.3.10-free.tar.gz(解压后qt-2.3.10改名为qt-2.3.10-target)
export QTEDIR=$PWD/qt-2.3.10-target
tar xfz qt-x11-2.3.2.tar.gz
export QT2DIR=$PWD/qt-2.3.2
tar xfz qtopia-free-source-2.1.1.tar.gz(解压后qtopia-free-2.1.1改名为qtopia-2.1.1-target)
export QPEDIR=$PWD/qtopia-2.1.1-target
tar xfz tmake-1.13.tar.gz
export TMAKEDIR=$PWD/tmake-1.13
export TMAKEPATH=$PWD/tmake-1.13/lib/qws/linux-arm-g++
export PATH=$TMAKEDIR/bin:$PATH
cd qt-2.3.2
export QTDIR=$QT2DIR
export PATH=$QTDIR/bin:$PATH
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
./configure -no-xft
make
make -C tools/qvfb
cd ..
cd qt-2.3.10-target
export QTDIR=$PWD
export PATH=$QTDIR/bin:$PATH
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
mkdir bin
cp $QT2DIR/bin/uic bin
cp $QT2DIR/tools/qvfb/qvfb bin
cp $QPEDIR/src/qt/qconfig-qpe.h src/tools/
./configure -xplatform linux-arm-g++ -qconfig qpe -qvfb -thread -system-jpeg -gif -depths 4,8,16,32
make
cd ..
注:这里交叉编译arm版本的Qt/E,需要arm版本的libjpeg.so.62,hybus-arm-linux-R1.1里面包含这个库;如没有可以上网下载。
tar xzf e2fsprogs-1.35.tar.gz
cd e2fsprogs-1.35
./configure -host=arm-linux -with-cc=arm-linux-gcc -with-linker=arm-linux-ld -enable-elf-shlibs -prefix=/usr/local/hybus-arm-linux-R1.1/arm-linux
make install lib/uuid/ ===>>>这步安装到hybus-arm-linux-R1.1/lib上的libuuid.so.1.2版本不对,要执行cp lib/libuuid.so.1.2 ../hybus-arm-linux-R1.1/lib
注:这步是交叉编译libuuid库,配置详情见./configure --help
(多谢http:/panjet.wleda.com/?p=20里面的大哥呀)
cd ..
cd qtopia-2.1.1-host
export PATH=$QPEDIR/bin:$PATH
export LD_LIBRARY_PATH=$QPEDIR/lib:$LD_LIBRARY_PATH
cp src/libraries/qtopia/custom-linux-ipaq-g++.cpp src/libraries/qtopia/custom-linux-arm-g++.cpp
cp src/libraries/qtopia/custom-linux-ipaq-g++.h src/libraries/qtopia/custom-linux-arm-g++.h
./configure -xplatform linux-arm-g++
make
注:这里需要libstdc++.so和libgcc_s.so库,hybus-arm-linux-R1.1/lib没有,所以要从网上下载;版本一定要是2.95.3。