Skip to content

Always Manually Link to Libc on Musl Targets #1124

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

Closed
1 of 2 tasks
Alexhuszagh opened this issue Nov 7, 2022 · 0 comments · Fixed by #1125
Closed
1 of 2 tasks

Always Manually Link to Libc on Musl Targets #1124

Alexhuszagh opened this issue Nov 7, 2022 · 0 comments · Fixed by #1125
Assignees
Milestone

Comments

@Alexhuszagh
Copy link
Contributor

Checklist

Describe your request

Currently, when building and linking to projects with more complex C/C++ dependencies, such as re2, the order of linking and the lack of a dynamic libstdc++ prevents numerous symbols, such as setlocale and __cxa_atexit from being found. Ever since #1063, we prevent dynamic linking to libstdc++ due to numerous issues it has in the generated binaries when linked to Rust code.

Describe why this would be a good inclusion for cross

This improves C++ for most musl targets, which we should support out-of-the-box.

@Alexhuszagh Alexhuszagh self-assigned this Nov 7, 2022
@Alexhuszagh Alexhuszagh added this to the v0.3.0 milestone Nov 11, 2022
@bors bors bot closed this as completed in a0721d8 Nov 12, 2022
bors bot added a commit that referenced this issue Nov 28, 2022
1134: Use a linker script for libstdc++. r=Emilgardis a=Alexhuszagh

Use a linker script for `libstdc++.so` since we remove the dylib, to ensure a static build is always used to avoid segfaults at runtime. However, the archive can reference missing symbols present in `libc` or `libgcc`, and itself depends on symbols in `libm`. To ensure these libraries are properly linked when forcing a build against the static `libstdc++`, create a linker script for `libstdc++.so` that links to the static archive, and as needed, all dependencies.

Related to #1124.

Co-authored-by: Alex Huszagh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant