1

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?

4

1 回答 1

0

Bazel 0.4.5 及更高版本支持使用 NDK11 和 NDK12 使用 clang 编译的 Android 构建。而对于 NDK13 及更高版本,clang 是默认设置(不支持 gcc)。使用 NDK11 和 NDK12,您可以设置 --android_compiler bazel 标志。例如,

$ 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
于 2017-05-10T22:38:06.357 回答