[FR] Provide static libc++ without exception
- Dominant language
- No language data
- Stars
- 2.3k
- Forks
- 310
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
Once using things that use exceptions, such as `new` and `unordered_set`, the exception will be included, which means a very huge size increase (~200KB per so file).
It is unacceptable the size of my so has increased from 14KB to 200KB only because I use `new`. Many things in the C++ world uses exception inside, it's impossible to avoid exceptions if we want to use C++. The option `-fno-exceptions` will not work of course since exceptions are included in the static library libc++ rather than the user's codes.
Crashing is so common in Android, and most times exception does not help. Use `new` as the example, if `new` (malloc inside) fails, it's obvious that throw an exception here does nothing help.
**Describe the solution you'd like**
Provide libcxx compiled with `-D_LIBCPP_NO_EXCEPTIONS` and `-D_LIBCPP_NO_RTTI` (and libcxxabi compiled with `-D_LIBCXXABI_NO_EXCEPTIONS`), then provided an option to let the user choose whether to use this libcxx or not.
Contributor guide
Research direction
Begin by reviewing how the Android NDK builds and packages libc++ and libc++abi, focusing on the requested no-exceptions and no-RTTI compile definitions. Determine how users could select a static variant without exceptions; done means the variant is provided alongside the existing option and its size impact can be verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, cpp
- Domain
- build-system, mobile-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100