Skip to content

[DOC] Clarify that the clang executable provided by NDK is mandatory #2217

@bottle2

Description

@bottle2

URL

https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md

Problem

Hey.

First of all, thanks for putting together this guide.

In the section Clang, it says:

Clang is installed to <NDK>/toolchains/llvm/prebuilt/<host-tag>/bin/clang. The C++ compiler is installed as clang++ in the same directory. clang++ will make C++ headers available when compiling and will automatically link the C++ runtime libraries when linking.
clang should be used when compiling C source files, and clang++ should be used when compiling C++ source files.

Please change wording to state that using the clang and clang++ provided by NDK in the aforementioned location is mandatory, whilst the non-NDK clang and clang++ the user has installed in his machine is not supported.

Reason: in a past attempt trying to use NDK, I had a very distressing situation where I spent hours trying to figure out why Gradle would fail, until I discovered that sdkmanager had installed x86_64 binaries, although I was in some ARM machine. Due to this negative experience, I figured out today that I would instead attempt to build with the non-NDK clang I have installed in my system, thinking that the clang that NDK provides was optional and merely a convenience. I wasted two hours until I interpreted again the guide and finally got it right using the NDK-provided clang.

I believe that the cause of the confusion is that typically when a user types clang on a fresh new shell, it uses the system-installed clang, so seeing an unadorned mention of clang and clang++ in the Guide visually stirs confusion that it might be referring to system installed clang, since that's exactly what you type in a new shell in order to use it. The Guide does use the word "installed", strongly suggesting that some change in search paths is implied, existent and in effect, but this might not be immediately understood by a rookie like me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions