Skip to content

[Backtracing] Declare a CMake dependency on CxxStdlib overlay #79017

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
wants to merge 1 commit into from

Conversation

egorzhdan
Copy link
Contributor

The Swift code in the Backtracing library enables C++ interop and uses C++ libraries that #include C++ stdlib headers. This means that Swift will pull in the C++ stdlib module, along with its overlay. The overlay module needs to be already built at that point.

This should fix an occasional compiler error:

error: could not find module 'CxxStdlib' for target

@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Jan 29, 2025
@egorzhdan egorzhdan requested a review from al45tair January 29, 2025 17:25
@egorzhdan egorzhdan requested a review from a team as a code owner January 29, 2025 17:25
The Swift code in the Backtracing library enables C++ interop and uses C++ libraries that `#include` C++ stdlib headers. This means that Swift will pull in the C++ stdlib module, along with its overlay. The overlay module needs to be already built at that point.

This should fix an occasional compiler error:
```
error: could not find module 'CxxStdlib' for target
```
@egorzhdan egorzhdan force-pushed the egorzhdan/backtracing-cxxstdlib branch from eec9cde to 0d52e3f Compare January 29, 2025 17:31
@egorzhdan egorzhdan requested a review from mikeash as a code owner January 29, 2025 17:31
@egorzhdan
Copy link
Contributor Author

@swift-ci please test

@al45tair
Copy link
Contributor

This is the problem; on Linux it's trying to link against -lswiftCxxStdlib-linux-x86_64-static for some reason I don't quite understand. I'd have expected it to use the path lib/swift_static/linux/x86_64/libswiftCxxStdlib.a but it doesn't. There's clearly something funny about the CxxStdlib module — I tried tinkering with the CMakeLists.txt that builds that but it isn't obvious to me what's causing this behaviour.

ld.lld: error: unable to find library -lswiftCxxStdlib-linux-x86_64-static

I wonder if @etcwilde or @edymtt have any ideas?

@al45tair
Copy link
Contributor

I think I understand what's going wrong. Just trying a build locally to verify my fix, then I'll either update this PR or raise one of my own.

@egorzhdan
Copy link
Contributor Author

This issue was fixed in #79057

@egorzhdan egorzhdan closed this Feb 10, 2025
@egorzhdan egorzhdan deleted the egorzhdan/backtracing-cxxstdlib branch February 10, 2025 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants