Skip to content

Android: Update toolchain selection for NDK r19

Brad King requested to merge brad.king/cmake:android-ndk-r19 into master

The <ndk>/build/core/toolchains/*/setup.mk files no longer have any TOOLCHAIN_ROOT or TOOLCHAIN_VERSION fields. The TOOLCHAIN_ROOT is now hard-coded in <ndk>/build/core/default-build-commands.mk. The NDK build system now uses only a single toolchain in

<ndk>/toolchains/llvm/prebuilt/<host>

The compilers are always bin/{clang,clang++} and the binutils are always bin/$(TOOLCHAIN_NAME)-*. It does not use -gcc-toolchain.

For now CMake can continue to use -gcc-toolchain. In future work we may be able to switch to what the NDK buildsystem now does. NDK r19 still provides the GCC toolchains (without the compilers) suitable for use with -gcc-toolchain. They are located in

<ndk>/toolchains/<toolchain>/prebuilt/<host>

Find a GCC toolchain for the target platform without TOOLCHAIN_ROOT by globbing for one of the binutils.

Fixes: #18739 (closed)

Merge request reports