Clone this repo:
  1. 32c89c1 Fix GCC bug PR 46639, for kernel security by Caroline Tice · 3 months ago master ndk-r15-release
  2. c82a251 [GCC] Add '--disable-multilib' to gcc configuration. by Caroline Tice · 3 months ago
  3. 41f3e25 fix errors in gcc compiler wrapper. by Yunlian Jiang · 7 months ago ndk-r14-release ndk-r14 ndk-r14-beta1 ndk-r14-beta2
  4. 7386949 Merge "[GCC 4.9] Fix posix_memalign declaration." by Caroline Tice · 7 months ago
  5. 5f67bb3 Merge "gcc: add a python wrapper for gcc." by Yunlian Jiang · 7 months ago

Building GCC for Android

The following process is used to build the GCC that is used by both the Android platfrom and the NDK.

Both Linux and Windows toolchains are built on Linux machines. Windows host binaries are built with mingw. Building binaries for Mac OS X should be built using 10.8 to ensure compatibility with Android's minimum supported hosts.

Prerequisites

  • Android GCC Repository

    • Check out the branch gcc

      repo init -u https://android.googlesource.com/platform/manifest -b gcc
      
      # Googlers, use
      repo init -u \
          persistent-https://android.git.corp.google.com/platform/manifest \
          -b gcc
      
  • Additional Linux Dependencies (available from apt):

    • texinfo
    • gcc-mingw32
    • bison
    • flex
    • libtool
  • Mac OS X also requires Xcode.

Host/Target prebuilts

For Linux or Darwin:

# Additional options and toolchain names will be show with --help.
$ python build.py --toolchain TOOLCHAIN_NAME

For Windows, from Linux:

$ python build.py --system windows TOOLCHAIN_NAME