zoukankan      html  css  js  c++  java
  • build android toochain on mac (gcc 4.4.3 compile)

    gcc 4.4.3 的编译器编译
     
    编译环境:
    gcc -version
    i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
    Copyright (C) 2007 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     
    uname -a
    Darwin Mine.local 12.2.1 Darwin Kernel Version 12.2.1: Thu Oct 18 16:32:48 PDT 2012; root:xnu-2050.20.9~2/RELEASE_X86_64 x86_64
     
    编译步骤

    1.checkout 源代码

    repo init -u https://android.googlesource.com/toolchain/manifest
    repo sync
     
    2.checkout 编译工具到正确的版本
    查看toolchain下的SOURCE文件 
    gcc/ synced to
            commit 2f2d3b42b0ea0c4871518c7b6176bd2b55ae527d
            Author: Jing Yu <jingyu@google.com>
            Date: Mon Dec 13 12:58:16 2010 -0800
     
        And rollback the following two androideabi related patches.
        commit a4d9421024ed3f70aede5b11f977d264eb69bf61
        Author: Jing Yu <jingyu@google.com>
        Date: Tue Aug 10 10:08:15 2010 -0700
     
        commit f01e65905acd1e2052e875130cb723a658765bc8
        Author: Jing Yu <jingyu@google.com>
        Date: Thu Jul 22 14:39:44 2010 -0700
     
    binutils/ synced to
            commit 8a5a8339de3149b7f99caf08e9cb72467d60cd01
            Author: Jing Yu <jingyu@google.com>
            Date: Thu Nov 4 17:22:38 2010 -0700
     
    gdb/ synced to
            commit b028dbaa736a574062136861a11e76a9ab6b4bb3
            Author: Jing Yu <jingyu@google.com>
            Date: Mon Dec 13 14:44:59 2010 -0800
     
    gmp/ synced to
            commit 9fb242a79dd122d7fbf867daf5620dba6927bd2e
            Author: Jing Yu <jingyu@google.com>
            Date: Thu Nov 5 17:43:59 2009 -0800
     
    mpfr/ synced to
            commit da6dfde986af1b56f0f41e9f5de61d093fa8af90
            Author: Jing Yu <jingyu@google.com>
            Date: Thu Nov 5 17:50:13 2009 -0800
     
    build/ synced to
            commit 4cc02faaa7e8828f9458b1828a6f85e7791ae2aa
            Author: Jim Huang <jserv@0xlab.org>
            Date: Fri Aug 20 23:30:37 2010 +0800
     
       And rollback the following 3 patches.
       commit de263c26a7680529baca731c003bc58b68d72511
       Author: Jing Yu <jingyu@google.com>
       Date: Thu Aug 12 15:52:15 2010 -0700
     
       commit a80c0ec10d3832039c5d5a481f5f62172eddc929
       Author: Jing Yu <jingyu@google.com>
       Date: Tue Aug 10 10:12:29 2010 -0700
     
       commit f82379147a1d2c484dcc1bb47c4ecd90e40fa3e2
       Author: Jing Yu <jingyu@google.com>
       Date: Thu Jul 22 14:27:24 2010 -0700
     按照上述内容check到相应的版本。
     
    3.准备sysroot
    可以自己先编译一版android os,只要确保bionic c被编译即可
    使用build下的脚本拷贝到sys root下
    ./build-sysroot.sh build_out_target_path sysroot_path
     
    4.build gcc
    创建一个buildgcc目录,进入该目录
    事先可以参照一下google的编译参数:
    arm-eabi-gcc -v
    Using built-in specs.
    Target: arm-eabi
    Configured with: /Volumes/project-jingyu/android_toolchain/build/../gcc/gcc-4.4.3/configure --prefix=/usr/local --target=arm-eabi --host=i686-apple-darwin --build=i686-apple-darwin --enable-languages=c,c++ --with-gmp=/Volumes/project-jingyu/toolchain-build/obj/temp-install --with-mpfr=/Volumes/project-jingyu/toolchain-build/obj/temp-install --disable-libssp --enable-threads --disable-nls --disable-libmudflap --disable-libgomp --disable-libstdc__-v3 --disable-sjlj-exceptions --disable-shared --disable-tls --with-float=soft --with-fpu=vfp --with-arch=armv5te --enable-target-optspace --with-abi=aapcs --with-gcc-version=4.4.3 --with-binutils-version=2.19 --with-gmp-version=4.2.4 --with-mpfr-version=2.4.1 --with-gdb-version=7.1.x --with-arch=armv5te --with-multilib-list=mandroid --with-sysroot=/Volumes/project-jingyu/cupcake_rel_root --enable-gold=both/gold --program-transform-name='s&^&arm-eabi-&'
    Thread model: single
    gcc version 4.4.3 (GCC) 
     
    接下来自己自己设定下自己的编译参数
    ../build/configure --with-gcc-version=4.4.3 --with-gmp-version=4.2.4 --with-binutils-version=2.19 --with-mpfr-version=2.4.1 --with-sysroot=sysroot_path --prefix=${PWD}/gccinstall --target=arm-eabi --build=x86_64-apple-darwin --with-multi-list=mandroid --enable-gold=both/gold --host=x86_64-apple-darwin --with-gdb-version=7.1.x
     
    本人测试过,binutils的版本不对的话,编译OS的时候会出错,是ld的问题
     
    由于mac的gcc 4.2目前默认带了-Wformat-security参数,编译binutils会有error,需要改下binutils-2.19的configure文件
    在-Wall 后面添加 -Wno-format
     
    make build
     
    5.install
    make install
     
    至此android 使用的 arm-eabi-gcc 4.4.3 就编译完成了
  • 相关阅读:
    自定义时间工具类
    http和https
    客户端是什么意思
    19.在HTTP 1.0中,状态码401的含义是(?);如果返回“找不到文件”的提示,则可用 header 函数,其语句为(?)写出http常见的状态码和含义,至少5个.[完善题目]
    20.谈谈对mvc的认识。
    18.有一个网页地址, 比如PHP开发资源网主页: http://www.phpres.com/index.html,如何得到它的内容?
    17.如何修改SESSION的生存时间。
    16.语句include和require的区别是什么?为避免多次包含同一文件,可用(?)语句代替它们?
    14.对于大流量的网站,您采用什么样的方法来解决访问量问题?
    15.用PHP写出显示客户端IP与服务器IP的代码,如何防止用户使用代理的情况?[添加更多详情]
  • 原文地址:https://www.cnblogs.com/zelos/p/2857470.html
Copyright © 2011-2022 走看看