Skip to content

[BUG] Compiling an Android NDK library with -lc++ links the C++ shared library even with ANDROID_STL=c++_static. #2229

@KKhanhH

Description

@KKhanhH

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

  • I have checked and the NDK I'm using is currently supported

Affected versions

r29

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions