android / android/ndk

[BUG] Can't auto hide STL Libc++ symbols since r22

Open
#1,408 10 comments 0 reactions 1 assignee Claimed by @rprichard View on GitHub
bug needs-info
Dominant language
No language data
Stars
2.3k
Forks
310
PR merge metrics
No merged PRs in 30d

Description

#### Description

I started to use r22, and found it generated bigger binary than r21.
And I found it show many std::string symbol in the binary.

So I need to add below code to hide it
```
#if (_LIBCPP_VERSION >= 11000)
#include
#include
_LIBCPP_BEGIN_NAMESPACE_STD
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __basic_string_common;
_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char)
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __vector_base_common;
_LIBCPP_END_NAMESPACE_STD
#endif
```
and add options in CMakeLists.txt
```
add_compile_options( -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS )
```

#### Environment Details

* NDK Version: r22
* Build system: Android Studio 4.1
* Host OS: Windows
* ABI: Any
* NDK API level: Any
* Device API level: Any

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.