Which compiler does Android NDK use?

Phonon picture Phonon · Jul 6, 2011 · Viewed 26.9k times · Source

I'm writing ARM NEON-based code for an Android application and I was struggling with certain compiler flags not being recognized. I later realized that support for those flags was only added quite recently and that my GCC version is older. I'm doing the whole thing on Windows and am limited by what versions Cygwin has to offer. Here's my question: before I go and try to build GCC 4.6.0 on my Windows machine and make Cygwin like it, will it work for me or does the NDK use its own version of the GCC and my upgrade will not at all affect it? If it does, is it possible to tell it to use a different compiler?

Answer

kalad picture kalad · Jan 16, 2013

Regarding NDK r8d it can be modified in 2 ways (see Andriod ndk):

  • For ndk-build, export the NDK_TOOLCHAIN_VERSION=4.7 variable or add it to Application.mk.
  • For standalone builds, add the --toolchain= option to make-standalone-toolchain.sh --toolchain=arm-linux-androideabi-4.7

Default compiler is set in ndk/build/core/setup-toolchain.mk (see NDK_TOOLCHAIN and NDK_TOOLCHAIN_VERSION)