From 692b82f82e216253b8164209c6227f6a8ebfb5a4 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 13 Apr 2022 14:26:02 -0700 Subject: [PATCH] bazel: Allow multiple definitions for armeabi android links When working on rust support we hit this issue https://github.com/rust-lang/compiler-builtins/issues/353 which seems to still be persistent even in the case you have the nightly version mentioned there. I haven't been able to reproduce the issue in a separate project, but the core seems to be that both libgcc and rust's compiler builtins module vendor some float math symbols and both are included. This change is as scoped as possible so that no real issues could sneak in with this disabled, which should mostly be covered by only passing this for the single arch. Signed-off-by: Keith Smiley --- library/common/jni/BUILD | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/library/common/jni/BUILD b/library/common/jni/BUILD index 7de713c03a..9d0c2be0e6 100644 --- a/library/common/jni/BUILD +++ b/library/common/jni/BUILD @@ -51,6 +51,14 @@ cc_library( alwayslink = True, ) +config_setting( + name = "android_armeabi", + constraint_values = [ + "@platforms//cpu:arm", + "@platforms//os:android", + ], +) + # Main dynamic library for the Envoy Mobile aar cc_binary( name = "libenvoy_jni.so", @@ -61,6 +69,10 @@ cc_binary( ] + select({ "@envoy//bazel:dbg_build": ["-Wl,--build-id=sha1"], "//conditions:default": [], + }) + select({ + # TODO(keith): https://github.com/rust-lang/compiler-builtins/issues/353 + ":android_armeabi": ["-Wl,--allow-multiple-definition"], + "//conditions:default": [], }), linkshared = True, deps = [