Skip to content

Define CppRuntime_Clang when building for Android #4634

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

Merged
merged 2 commits into from
Apr 29, 2024

Conversation

s-ludwig
Copy link
Contributor

With the current switch to NDK 26+ it should now be safe to assume the Clang C++ mangling/runtime.

The background for adding this is that the BindBC bindings currently error out when building for Android, because they require a C++ runtime version in order to potentially perform some manual symbol mangling.

With the current switch to NDK 26+ it should now be safe to assume the Clang C++ mangling/runtime.
@s-ludwig
Copy link
Contributor Author

ld.lld: error: duplicate symbol: std::bad_alloc::bad_alloc()
defined at new_.d
new_.o:(std::bad_alloc::bad_alloc()) in archive /home/runner/work/ldc/build-cross-libs/lib/libdruntime-ldc.a
defined at stdlib_exception.cpp
stdlib_exception.cpp.o:(std::bad_alloc::bad_alloc()) in archive /home/runner/work/ldc/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/libc++abi.a

How is this supposed to work? It seems like this is always defined on the D side, but for some reason errors out for the Android libc++ - should this be changed in DRuntime to only declare the constructor?

@kinke
Copy link
Member

kinke commented Apr 29, 2024

How is this supposed to work? It seems like this is always defined on the D side, but for some reason errors out for the Android libc++ - should this be changed in DRuntime to only declare the constructor?

The ctor should most likely be marked extern(D), as done for the other exception-derived classes in https://github.com/dlang/dmd/blob/b84fa4709f2061b60c2fd398a01964370cbb12c8/druntime/src/core/stdcpp/typeinfo.d#L185-L199.

@kinke kinke merged commit 520f829 into ldc-developers:master Apr 29, 2024
dlang-bot pushed a commit to dlang/dmd that referenced this pull request Apr 29, 2024
This adjusts the constructor to be extern(D), analogous to the other C++ exception class definitions.

See ldc-developers/ldc#4634
@s-ludwig s-ludwig deleted the patch-1 branch April 30, 2024 07:00
kinke pushed a commit that referenced this pull request May 3, 2024
This adjusts the constructor to be extern(D), analogous to the other C++ exception class definitions.

See #4634
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