[Android NDK] libandroid_support.a incorrectly being linked on API 21+ when building fully static binary with c++-static #12840
Labels
P2
We'll consider working on this in future. (Assignee optional)
team-Android
Issues for Android team
type: bug
Description of the problem / feature request:
When building a fully statically linked binary with the
c++-static
STL on Android,libandroid_support.a
gets linked unconditionally, which leads to multiple definition errors like:As I understand it,
libandroid_support.a
is only supposed to be used on API versions older than 21 and only on armeabi-v7a and x86.I suspect this behavior is caused by the glob defined here:
bazel/src/main/java/com/google/devtools/build/lib/bazel/rules/android/ndkcrosstools/NdkPaths.java
Lines 270 to 271 in 8346ea4
libandroid_support.a
is in the same directory aslibc++_static.a
.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
I've created a simple repro here: https://gist.github.com/chenxiaolong/dcda157428e60489efa7a2f9346e581e
What operating system are you running Bazel on?
Ubuntu 20.04.1 on WSL2
What's the output of
bazel info release
?3.7.2
If
bazel info release
returns "development version" or "(@non-git)", tell us how you built Bazel.n/a
What's the output of
git remote get-url origin ; git rev-parse master ; git rev-parse HEAD
?n/a
Have you found anything relevant by searching the web?
This was the same issue, but for CMake: android/ndk#17
This is the comment from an NDK maintainer mentioning that libandroid_support is mean for API <21: android/ndk#17 (comment)
Any other information, logs, or outputs that you want to share?
n/a
The text was updated successfully, but these errors were encountered: