Hi,
I am building a big project with CMake (just easier to manage than writing Android.bp files manually) using NDK standalone toolchain. The project runs perfectly fine on Android Pie.
However, some project parts I would like to build as libraries that would be used by some other AOSP native components. Tipically I do the external building with CMake and write a small Android.bp file that includes these libraries as prebuilt static/dynamic libraries.
Then I include them as static/dynamic library dependencies that I link against when building a new binary with Soong.
I can link binaries built with Soong with my external libraries as long as my library interface does not use any STL data types (e.g. std::string). As soon as I start using STL data types in my library interfaces, the linking process fails with ''undefined references" for STL types used.
I delve into the problematic a little bit and discovered that STL libc++ shipped with NDK standalone toolchain and the one used by the prebuilt AOSP clang compiler (used by Soong) have different name manglings, even if the library and compiler versions are the same. The difference is in the inline namespacing.
Example (c++filt):
std::__1::basic_string
std::__ndk1::basic_string
My question is, why the NDK libc++ inline namespaces are named differently? This is very annoying since I have to restrict my API to non-STL types.
Is there any way to configure the AOSP build system to use the NDK standalone toolchain to build the entire project?