zoukankan      html  css  js  c++  java
  • QT_IMX交叉编译 ARM 版本

    Qt4.8.5 为了支持开发板中的触摸屏,在编译 Qt 之前,要先编译 tslib 库。

    root@yechuang:~# sudo gedit /etc/bash.bashrc

    1. IMX28环境变量做如下设置:
      export ARCH=arm
      export
      CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/arm-no
      ne-linux-gnueabi-
      export PATH=/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin:$PATH 
    2. IMX6环境变量做如下设置:
    export ARCH=arm
    export CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-multilib-2011.12/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi-
    export PATH=~/imx6/L3.0.35_4.1.0_130816_source/source/ltib/rpm/BUILD/u-boot-2009.08/tools:$PATH
    export PATH=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-multilib-2011.12/fsl-linaro-toolchain/bin:$PATH
    
    root@yechuang:~# source /etc/bash.bashrc
    

        3. 编译 tslib 库

    https://github.com/kergoth/tslib 下载tslib,解压 切换到/home/yechuang/Qt目录

    root@yechuang:/home/yechuang/Qt# unzip tslib-master.zip 
    
    root@yechuang:/home/yechuang/Qt# sudo chmod 777 tslib-master/ –R
    
    root@yechuang:/home/yechuang/Qt/tslib-master# ls
    acinclude.m4      autogen.sh    COPYING  m4           plugins  tests
    AUTHORS           ChangeLog     etc      Makefile.am  README   TODO
    autogen-clean.sh  configure.ac  INSTALL  NEWS         src      tslib.pc.in
    
    
    root@yechuang:/home/yechuang/Qt/tslib-master# ./autogen.sh 
    ./autogen.sh: 3: autoreconf: not found
    

    错误原因:是在不同版本的 tslib 下执行 autogen.sh 产生。它们产生的原因一样,是
    因为没有安装automake 工具,  (ubuntu 10.04)用下面的命令安装就可以了。
     

    sudo apt-get install autoconf automake libtool
    开始安装:

    root@yechuang:/home/yechuang/Qt/tslib-master# ./autogen.sh
    开始编译:

    root@yechuang:/home/yechuang/Qt/tslib-master# ./configure --host=arm-linux --prefix /home/yechuang/Qt/tslib-instal/

    执行安装:

    root@yechuang:/home/yechuang/Qt/tslib-master#make install

    在tslib-master下看到这几个文件夹,表明已经安装完毕。

    root@yechuang:/home/yechuang/Qt/tslib-master# ls ../tslib-instal/
    bin  etc  include  lib


    4.交叉编译 Qt

    4.1. 在/home/yechuang/Qt 目录中,删除之前 x86 版本的 qt4.8.5 安装文件夹 qt-everywhere-opensource-src-4.8.5 并重
    新解压:$ tar –zxvf qt-everywhere-opensource-src-4.8.5.tar.gz
    进入 qt 的源码中,在进入 mkspecs 文件夹

    root@yechuang:/home/yechuang/Qt/qt-everywhere-opensource-src-4.8.5# cd mkspecs/
    
    root@yechuang:/home/yechuang/Qt/qt-everywhere-opensource-src-4.8.5/mkspecs# cp qws/linux-arm-gnueabi-g++ qws/linux-arm-fsl-gnueabi-g++ -r
    

    为了避免破坏 Qt 的源码,我们自己复制一份,然后自此基础上修改;

    4.2. 进入 linux-arm-fsl-gnueabi-g++,修改 qmake.conf 文件

    root@yechuang:/home/yechuang/Qt/qt-everywhere-opensource-src-4.8.5/mkspecs# cd qws/linux-arm-fsl-gnueabi-g++/
    root@yechuang:/home/yechuang/Qt/qt-everywhere-opensource-src-4.8.5/mkspecs/qws/linux-arm-fsl-gnueabi-g++# ls
    qmake.conf  qplatformdefs.h
    
    inux-arm-fsl-gnueabi-g++# gedit qmake.conf 
    

    打开源码为:

    #
    # qmake configuration for building with arm-none-linux-gnueabi-g++
    #
    
    include(../../common/linux.conf)
    include(../../common/gcc-base-unix.conf)
    include(../../common/g++-unix.conf)
    include(../../common/qws.conf)
    
    # modifications to g++.conf
    QMAKE_CC                = arm-none-linux-gnueabi-gcc
    QMAKE_CXX               = arm-none-linux-gnueabi-g++
    QMAKE_LINK              = arm-none-linux-gnueabi-g++
    QMAKE_LINK_SHLIB        = arm-none-linux-gnueabi-g++
    
    # modifications to linux.conf
    QMAKE_AR                = arm-none-linux-gnueabi-ar cqs
    QMAKE_OBJCOPY           = arm-none-linux-gnueabi-objcopy
    QMAKE_STRIP             = arm-none-linux-gnueabi-strip
    
    load(qt_config)

    跟官方提供的编译参数不同,这里我不敢做大的修改,只是在下面添加一行命令,如果有问题我在修改为提供的编译环境。

    image

    #
    # qmake configuration for building with arm-none-linux-gnueabi-g++
    #
    
    include(../../common/linux.conf)
    include(../../common/gcc-base-unix.conf)
    include(../../common/g++-unix.conf)
    include(../../common/qws.conf)
    
    # modifications to g++.conf
    QMAKE_CC                = arm-linux-gcc -lts
    QMAKE_CXX               = arm-linux-g++ -lts
    QMAKE_LINK              = arm-linux-g++ -lts
    QMAKE_LINK_SHLIB        = arm-linux-g++ -lts
    
    # modifications to linux.conf
    QMAKE_AR                = arm-linux-ar cqs
    QMAKE_OBJCOPY           = arm-linux-objcopy
    QMAKE_STRIP             = arm-linux-strip
    
    load(qt_config)

    添加行为:

    QMAKE_LIBS_THREAD = -lpthread -lts
    

    4.3. 配置 Qt :将所给的 run.sh 脚本拷贝到 qt 源码目录,sudo chmod +x run.sh 添加权限,然后$ ./run.sh

    root@yechuang:/home/yechuang/Qt# ls
    qt-everywhere-opensource-src-4.8.5         run.sh        tslib-master
    qt-everywhere-opensource-src-4.8.5.tar.gz  tslib-instal
    root@yechuang:/home/yechuang/Qt/qt-everywhere-opensource-src-4.8.5# sudo chmod +x run.sh
    root@yechuang:/home/yechuang/Qt/qt-everywhere-opensource-src-4.8.5# ./run.sh
    4.4. make 编译;
    root@yechuang:/home/yechuang/Qt/qt-everywhere-opensource-src-4.8.5# make
    这个时候还没有生成makefile,不能直接编译,我执行
    root@yechuang:/home/yechuang/Qt/qt-everywhere-opensource-src-4.8.5#./configure
    ………………
    root@yechuang:/home/yechuang/Qt/qt-everywhere-opensource-src-4.8.5# ls
    bin              configure.exe  INSTALL             Makefile      run.sh
    changes-4.8.5    demos          LGPL_EXCEPTION.txt  mkspecs       src
    config.profiles  doc            lib                 plugins       templates
    config.status    examples       LICENSE.FDL         projects.pro  tools
    config.tests     imports        LICENSE.GPL3        qmake         translations
    configure        include        LICENSE.LGPL        README        util
    
     
    生成makefile,之后在进行make。
    root@yechuang:/home/yechuang/Qt/qt-everywhere-opensource-src-4.8.5# make
    执行通过。

    4.5. 执行安装命令,由于 run.sh 没有指定安装路径,所以默认还是安装在了 usr/local/ Trolltech/
    QtEmbedded-4.8.5-arm;

    root@yechuang:/home/yechuang/Qt/qt-everywhere-opensource-src-4.8.5# make install
     

    4.6. 打开 qt creator


    4.7. 选择 Qt 版本,点击添加

    gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12.tar  问题???

    不能安装。

  • 相关阅读:
    new Array()和 = [] 二种初始化数组的性能比较
    指定 Flash Player 在加载对象前是否应检查跨域策略文件是否存在
    FLEXRangeError: Error #2006: 提供的索引超出范围
    把RSS订阅到邮箱去
    使用特殊效果创建一个堆叠纸张对登录表单
    30个特别的涂鸦和壁画
    12个免费的从文本到语音转换 的在线服务和工具
    40个创意的IPhone壁纸大集合,做应用程序必备
    如何防止 yum 自动更新
    VirtualBox 与 宿主机剪贴板共享问题
  • 原文地址:https://www.cnblogs.com/yechuang/p/4518570.html
Copyright © 2011-2022 走看看