Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i#2154 Android64: Link static c++ runtime library #7239

Merged
merged 6 commits into from
Feb 13, 2025

Conversation

jackgallagher-arm
Copy link
Collaborator

@jackgallagher-arm jackgallagher-arm commented Jan 31, 2025

Android splits the C++ STL runtime into a separate library which is not provided as a standard system library. Applications are expected to statically link the STL library (libc++_static.a) or distribute the dynamic library (libc++_shared.so) with the application [1].

All C++ targets should now be linking the static runtime libraries.

[1] https://developer.android.com/ndk/guides/cpp-support#important_considerations

Issue: #2154, #1874

Android splits the C++ STL runtime into a separate library which is not
provided as a standard system library. Applications are expected to
statically link the STL library (libc++_static.a) or distribute the
dynamic library with the application.

The NDK C++ support guide recommends using the shared library C++
runtime if you are building a shared library or an application that uses
shared libraries [1] so I have set the DynamoRIO CMake scripts to do
that by default and added code to deal with deploying libc++_shared.so.

This is handled in two places:
 - drsyms CMakeLists.txt explicitly installs libc++_shared.so into
   ${INSTALL_EXT_LIB} with the other dependency libraries. This will
   ensure the library is included when generating a DynamoRIO package.

 - DynamoRIO_copy_target_to_device() now checks if a target it is
   copying is a C++ target and automatically copies the runtime library
   as well if it is.

[1] https://developer.android.com/ndk/guides/cpp-support#important_considerations

Issue: #2154, #1874
CMakeLists.txt Outdated Show resolved Hide resolved
@jackgallagher-arm jackgallagher-arm changed the title i#2154 Android64: Deploy c++ runtime library i#2154 Android64: Link static c++ runtime library Feb 10, 2025
@jackgallagher-arm jackgallagher-arm merged commit a09c4c9 into master Feb 13, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants