Clone this repo:
  1. a9d5e6f Remove support for 32-bit Windows. by Dan Albert · 7 days ago master
  2. 4c6f623 Adapt to ndk.hosts changes. by Dan Albert · 3 months ago
  3. f236b44 Bootstrap build with Python 3. by Dan Albert · 7 months ago ndk-release-r20 ndk-r20 ndk-r20-beta1 ndk-r20-beta2 ndk-r20-beta3
  4. ef58803 Build libgcc_s DLLs with additional linker flags by Pirama Arumuga Nainar · 10 months ago ndk-release-r19 ndk-r19 ndk-r19-beta1 ndk-r19-beta2 ndk-r19b ndk-r19c
  5. a74813a Merge "Add __emutls_unregister_key function" by Treehugger Robot · 11 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