NDK + gradle: Which NDK API level is used?

441 views
Skip to first unread message

Chris Browet

unread,
Mar 28, 2019, 11:22:06 AM3/28/19
to android-ndk
Hi,

I'm adjusting my builds to NDK 19 and the deprecation of the toolchains, and I come to realize that I have no clue which NDK API gradle is using to build app.
Even building in verbose doesn't make it clear.

A warning sign came when I saw
debugUnsigned|arm64-v8a :-- Check for working C compiler: /opt/android-dev/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -- works
 in my logs, where I would be expecting something like "/opt/android-dev/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang".

It is quite important (I think) when it come to linking the proper versions of libandroid and libmediandk.

Is it somehow automagically deduced from minSdkVersion of build.gradle, or... ?
What is "/opt/android-dev/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang" vs., e.g., "/opt/android-dev/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang"?

Thanks

Dan Albert

unread,
Mar 28, 2019, 12:25:34 PM3/28/19
to android-ndk
Yes, NDK API level is minSdkVersion (or the lowest available API level for the architecture, if minSdkVersion is below it; 21 is the oldest API level that supports arm64). The 21 in the compiler triple is the API level.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/a7970c5b-1a2c-4c17-b22f-c25450b91bb0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris Browet

unread,
Mar 28, 2019, 1:39:36 PM3/28/19
to android-ndk
Thanks Dan.

Can you also enlight me re "/opt/android-dev/android-ndk-
r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang" vs., e.g., "/opt/android-dev/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang"?

What is the "generic" clang? A wrapper of sorts?

On Thursday, 28 March 2019 17:25:34 UTC+1, Dan Albert wrote:
Yes, NDK API level is minSdkVersion (or the lowest available API level for the architecture, if minSdkVersion is below it; 21 is the oldest API level that supports arm64). The 21 in the compiler triple is the API level.

On Thu, Mar 28, 2019, 08:22 Chris Browet <christi...@gmail.com> wrote:
Hi,

I'm adjusting my builds to NDK 19 and the deprecation of the toolchains, and I come to realize that I have no clue which NDK API gradle is using to build app.
Even building in verbose doesn't make it clear.

A warning sign came when I saw
debugUnsigned|arm64-v8a :-- Check for working C compiler: /opt/android-dev/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -- works
 in my logs, where I would be expecting something like "/opt/android-dev/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang".

It is quite important (I think) when it come to linking the proper versions of libandroid and libmediandk.

Is it somehow automagically deduced from minSdkVersion of build.gradle, or... ?
What is "/opt/android-dev/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang" vs., e.g., "/opt/android-dev/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang"?

Thanks

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to andro...@googlegroups.com.

Dan Albert

unread,
Mar 28, 2019, 1:42:31 PM3/28/19
to android-ndk
The non-prefixed Clang is the actual Clang. Clang is a cross-compiler by default. The prefixed Clangs are the wrappers (if you inspect them, you'll see that they're shell/batch scripts that invoke the real Clang) that select the correct target triple to aid tools like autoconf that aren't set up to pass --target explicitly.


To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.

To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.

Chris Browet

unread,
Mar 28, 2019, 2:51:49 PM3/28/19
to android-ndk
Great. Thanks for the clarifications.


On Thursday, 28 March 2019 18:42:31 UTC+1, Dan Albert wrote:
The non-prefixed Clang is the actual Clang. Clang is a cross-compiler by default. The prefixed Clangs are the wrappers (if you inspect them, you'll see that they're shell/batch scripts that invoke the real Clang) that select the correct target triple to aid tools like autoconf that aren't set up to pass --target explicitly.


Reply all
Reply to author
Forward
0 new messages