Android NDK GCC appears to be clang – is it the way it should be?

Issue

A freshly downloaded NDK fails on linking old projects with error:

/usr/bin/ld: unrecognised emulation mode: armelf_linux_eabi

As it appears, clang hides behind the mask of gcc:

/opt/android-ndk-r18b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc --version
Android (4751641 based on r328903) clang version 7.0.2 (https://android.googlesource.com/toolchain/clang 003100370607242ddd5815e4a043907ea9004281) (https://android.googlesource.com/toolchain/llvm 1d739ffb0366421d383e04ff80ec2ee591315116) (based on LLVM 7.0.2svn)
Target: arm--linux-android
Thread model: posix
InstalledDir: /opt/android-ndk-r18b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../../../../llvm/prebuilt/linux-x86_64/bin

Is it just a bug in this NDK version or it was made by intent?

Solution

It’s as it should be.

GCC was deprecated in r15, and removed in r18. But to ease the transition for developers, wrapper scripts were provided which makes it seem like GCC still exists while actually using Clang.

Answered By – Michael

Leave a Comment