在fedora9 x86_64上编译arm qt2.2.0

系统:Fedora9 x86_64

1>下载cross-3.3.2.tar.bz2,并解压到/usr/local/arm/文件夹下,设置环境变量PATH
    tar zjf cross-3.3.2.tar.bz2 -C /usr/local/arm/
    export PATH=$PATH:/usr/local/arm/3.3.2/bin

2>建立目录armqt,设置环境变量
    mkdir /home/armqt           //arm qt根目录
    export ARMQT=/home/armqt
    mkdir $ARMQT/tools             //arm库
    mkdir $ARMQT/tools/lib         //arm库lib
    mkdir $ARMQT/tools/include     //arm库include
    mkdir $ARMQT/arm220            //编译arm qt
    mkdir $ARMQT/qtopia            //make install的路径,生成的qt及其库的文件系统文件夹

3>下载qtopia-free-src-2.2.0.tar.gz解压到$ARMQT/arm220,省掉下一级qtopia-free-2.2.0目录

4>下载arm需要的库,并解压到$ARMQT/tools下,并编译
A e2fsprogs-1.39.tar.gz

    下载地址
    http://nchc.dl.sourceforge.net/sourceforge/e2fsprogs/e2fsprogs-1.39.tar.gz

    安装
    ./configure --host=arm-linux --enable-elf-shlibs --with-cc=arm-linux-gcc  --with-linker=arm-linux-ld --prefix=/usr/local/arm/2.95.3/arm-linux
    make
    cp lib/libuuid.so* ../lib/

B jpegsrc.v6b.tar.gz

    下载地址
    http://down1.chinaunix.net/distfiles/jpegsrc.v6b.tar.gz

    I 缺少libtool,下载           
    yum install libtool
    cp /usr/share/libtool/config.guess /home/armqt/tools/jpeg-6b/ -rf
    cp /usr/share/libtool/config.sub /home/armqt/tools/jpeg-6b/ -rf

    II ./configure --enable-shared

    III 修改Makfile,搜索到CC,AR,AR2宏替换为下面(如果是export CC=arm-linux-gcc,
    在Makefile中虽然cc,ld等变了,但是ar,ranlib就没有改变)
    CC=arm-linux-gcc
    AR=arm-linux-ar rc
    AR2=arm-linux-ranlib

    IV make

    V 拷贝库文件和头文件到统一目录
    cp *.h ../include/
    cp .libs/libjpeg.so* ../lib/

    VI 可以用file看一下编译出来的是否是arm版本的及是否动态链接
    [root@localhost jpeg-6b]# file wrjpgcom
    wrjpgcom: ELF 32-bit LSB executable, ARM, version 1, dynamically linked (uses shared libs), for     GNU/Linux 2.0.0, not stripped

C zlib-1.2.3.tar.bz2

    下载地址
    http://www.zlib.net/zlib-1.2.3.tar.gz

    I ./configure -shared

    II 修改Makfile,搜索到CC,LDSHARED,CPP,AR,RANLIB,prefix宏替换为下面
        CC=arm-linux-gcc
        CPP=arm-linux-gcc -E
        LDSHARED=arm-linux-gcc -shared -Wl,-soname,libz.so.1
        AR=arm-linux-ar rc
        RANLIB=arm-linux-ranlib
        prefix=/usr/local/arm/3.3.2/arm-linux

    III make

    IV 拷贝库文件和头文件到统一目录
    cp libz.so* ../lib/
    cp *.h ../include/

D libpng-1.2.14.tar.bz2

    下载地址
    http://superb-east.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.14.tar.bz2

    I cp scripts/makefile.linux Makefile

    II 修改Makfile,搜索到CC,AR,AR2,prefix,ZLIBLIB,ZLIBINC宏替换为下面
        CC=arm-linux-gcc
        AR=arm-linux-ar rc
        AR2=arm-linux-ranlib
        prefix=/usr/local/arm/3.3.2/arm-linux
        ZLIBLIB=../lib
        ZLIBINC=../include

    III make

    IV 拷贝库文件和头文件到统一目录
    cp libpng12.so* ../lib/
    cp libpng12.so ../lib/libpng.so
    cp *.h ../include/

E uic-qt2

    下载地址
    http://vanille.de/tools/uic-qt2
   
    chmod 777 uic-qt2
    cp uic-qt2 $ARMQT/arm220/qt2/bin/uic

5>编译qt前的准备
A修改文件$ARMQT/arm220/qtopia/mkspecs/qws/linux-arm-g++/qmake.conf
    chmod 777 $ARMQT/arm220/qtopia/mkspecs/qws/linux-arm-g++/qmake.conf

    QMAKE_LIBS_QT = -lqte
    改为
    QMAKE_LIBS_QT = -lqte -lpng -lz -luuid -ljpeg

B修改文件$ARMQT/arm220/qtopia/src/qt/qconfig-qpe.h
    chmod 777 $ARMQT/arm220/qtopia/src/qt/qconfig-qpe.h
    添加到文件最后
    #define QT_QWS_IPAQ
    #define QT_QWS_IPAQ_RAW

C修改文件$ARMQT/arm220/qt2/include/qvaluestack.h
    chmod 777 $ARMQT/arm220/qt2/include/qvaluestack.h
    remove( this->fromLast() );
    改为
    this->remove( this->fromLast() );

D修改文件$ARMQT/arm220/qtopia/src/libraries/qtopia/qdawg.cpp
    chmod 777 $ARMQT/arm220/qtopia/src/libraries/qtopia/qdawg.cpp
    QDawgPrivate::~QDawgPrivate()
    改为
    ~QDawgPrivate()

E
    cp $ARMQT/arm220/qtopia/src/qt/qconfig-qpe.h $ARMQT/arm220/qt2/src/tools
    cd $ARMQT/arm220/qtopia/src/libraries/qtopia
    cp custom-linux-ipaq-g++.cpp custom-linux-arm-g++.cpp
    cp custom-linux-ipaq-g++.h custom-linux-arm-g++.h

F编译时出现了qvfb错误,没搜到网上别人怎么做的,反正arm也用不上,所以干脆删了
    rm $ARMQT/arm220/dqt/tools/qvfb -rf

G下面都是在编译时少什么就加什么库,先用yum whatprovides确定库名字,然后用yum install更新,感觉很不安全一样,我怕影响有些什么功能不能使用了.gcc -m32也就是32位编译了,不知道为什么更新后它自动加上了-m32,是自适应还是手动?

/*****
本来安装了这3个包,但是按照前2天在32位机上使用gcc32的做法(替换gcc,g++,lib)会出错,所以只好放弃,谁能告诉我怎样在x86_64上用i386 gcc32?
compat-gcc-32-3.2.3-47.3.i386.rpm
compat-gcc-32-c%2B%2B-3.2.3-47.3.i386.rpm
compat-libstdc++-33-3.2.3-63.i386.rpm
******/

    I gcc少头文件和libc
    yum whatprovides */gnu/stubs-32.h
    yum install glibc-devel.i386
 
    yum whatprovides */4.3.0/libstdc++.a
    yum install libstdc++-devel.i386

    II 编译时缺少的其他i386库
    yum whatprovides */libXext.so
    yum install libXext-devel.i386
    
    yum whatprovides */libX11*
    yum install libX11-devel.i386
    yum install libX11.i386
    
    yum whatprovides */libSM*
    yum install libSM.i386
    cd /usr/lib64
    rm libSM.so -rf
    ln -s ../lib/libSM.so.6 libSM.so

    yum whatprovides */libICE*
    yum install libICE-devel.i386

H 配置环境变量
    export QPEDIR=$ARMQT/arm220/qtopia
    export QTDIR=$ARMQT/arm220/qtopia
    export QTDIR=$ARMQT/arm220/qt2
    export LD_LIBRARY_PATH=$QTDIR/lib:$QPEDIR/lib:$LD_LIBRARY_PATH
    export TMAKEDIR=$ARMQT/arm220/tmake
    export TMAKEPATH=$TMAKEDIR/lib/qws/linux-arm-g++

6>配置及编译qt, 最好配置是手敲的,网上考下来的容易少空格,配置错了又要重编划不来
    echo 'yes'|./configure -qte "-embedded -xplatform linux-arm-g++ -qconfig qpe -no-qvfb -depths 16,24 -system-jpeg -system-libpng -system-zlib -gif -thread -no-xft -release -I$ARMQT/tools/include -L$ARMQT/tools/lib -lpng -lz -luuid -ljpeg" -qpe "-xplatform linux-arm-g++ -edition pda -displaysize 320x240 -I$ARMQT/tools/include -L$ARMQT/tools/lib -prefix=$ARMQT/qtopia"

    make
    make install

总算编出来了

你可能感兴趣的:(在fedora9 x86_64上编译arm qt2.2.0)