Add Android stlport and default toolchains to BUILD. (#8290)

These are additional possibilities for --crosstool_top for Android NDK
compilation. Since the NDK doesn't have -lpthread, getting these flags
wrong leads to a linker error.

Fixes: 180084220
pull/9098/head
Justin Paupore 3 years ago committed by GitHub
parent 40e9cedf7a
commit 255dec16d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 31
      BUILD

31
BUILD

@ -65,6 +65,13 @@ create_compiler_config_setting(
], ],
) )
# Android NDK builds can specify different crosstool_top flags to choose which
# STL they use for C++. We need these multiple variants to catch all of those
# versions of crosstool_top and reliably detect Android.
#
# For more info on the various crosstool_tops used by NDK Bazel builds, see:
# https://docs.bazel.build/versions/master/android-ndk.html#configuring-the-stl
config_setting( config_setting(
name = "android", name = "android",
values = { values = {
@ -76,6 +83,17 @@ config_setting(
], ],
) )
config_setting(
name = "android-stlport",
values = {
"crosstool_top": "@androidndk//:toolchain-stlport",
},
visibility = [
# Public, but Protobuf only visibility.
"//:__subpackages__",
],
)
config_setting( config_setting(
name = "android-libcpp", name = "android-libcpp",
values = { values = {
@ -98,11 +116,24 @@ config_setting(
], ],
) )
config_setting(
name = "android-default",
values = {
"crosstool_top": "@androidndk//:default_crosstool",
},
visibility = [
# Public, but Protobuf only visibility.
"//:__subpackages__",
],
)
# Android and MSVC builds do not need to link in a separate pthread library. # Android and MSVC builds do not need to link in a separate pthread library.
LINK_OPTS = select({ LINK_OPTS = select({
":android": [], ":android": [],
":android-stlport": [],
":android-libcpp": [], ":android-libcpp": [],
":android-gnu-libstdcpp": [], ":android-gnu-libstdcpp": [],
":android-default": [],
":msvc": [ ":msvc": [
# Suppress linker warnings about files with no symbols defined. # Suppress linker warnings about files with no symbols defined.
"-ignore:4221", "-ignore:4221",

Loading…
Cancel
Save