简体   繁体   中英

Can Bazel be configured to work with Clang on Android NDK?

There's a note in this Bazel example for android that says:

Yes, we know that this is a little clunky. We are working on the following things (and more):

Supporting other architectures than armeabi-v7a and compilers other than GCC 4.9

Is there any way to hack around this to swap GCC for Clang until it is officially supported?

Bazel 0.4.5 and later support Android builds compiling with clang with NDK11 and NDK12. And with NDK13 and later, clang is the default (and gcc is not supported). With NDK11 and NDK12, you can set the --android_compiler bazel flag. For example,

$ cat WORKSPACE
android_sdk_repository(name = "androidsdk")
android_ndk_repository(name = "androidndk")

$ export ANDROID_HOME=/home/me/sdk

$ export ANDROID_NDK_HOME=/home/me/android-ndk-r12b

# uses clang
$ bazel build --android_compiler=clang3.8 //java/com/example:app

$ export ANDROID_NDK_HOME=/home/me/android-ndk-r13b

# uses clang
$ bazel build //java/com/example:app

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM