[BUG] Compiling an Android NDK library with -lc++ links the C++ shared library even with ANDROID_STL=c++_static.
- Dominant language
- No language data
- Stars
- 2.3k
- Forks
- 310
- PR merge metrics
- No merged PRs in 30d
Description
### Description
Compiling an Android NDK shared library with -lc++ links the C++ shared library even with ANDROID_STL=c++_static.
I'm not sure if this is intended behavior or not, or if you're not supposed to have -lc++ when doing static builds, but this seems to break some of the dependencies that VCPKG builds which adds the implicit cxx linker libraries to their transitive dependencies. I imagine it would make more sense that a library linking to libc++ through the -lc++ flag should still link to the static library.
Test Case:
Checkout the ndk_bug branch, follow README and build the library.
Run `llvm-readelf.exe -d libndktest.so`, the output will show libc++_shared.so is needed.
https://github.com/KKhanhH/test_vcpkg_libass/tree/ndk_bug
(Ignore repository name, I'm using another branch to file another bug on vcpkg's end as well.)
Reproducible on NDK r28 and r29
### I am using a supported NDK
- [x] I have checked and the NDK I'm using is currently supported
### Affected versions
r29
Contributor guide
Research direction
Start with the linked ndk_bug branch and follow its README to build the shared library, then run llvm-readelf.exe -d libndktest.so as described. Compare the result for ANDROID_STL=c++_static with the explicit -lc++ flag; done when the observed library dependency matches the intended static-build behavior and the regression is covered or clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- build-system, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100