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

[cxx-interop] Do not pass -lc++/-lstdc++ flags to the compiler #8160

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

egorzhdan
Copy link
Contributor

Motivation:

The Swift compiler has recently introduced support for building with C++ stdlibs which aren't the default on the target platform, specifically libc++ on Linux. The Swift Driver has logic to determine which C++ stdlib should be used, depending on the target and explicit -Xcc -stdlib=xyz flags, and link against the requested standard library. Similar functionality exists in Clang Driver. We should defer the C++ stdlib selection to the compiler driver, it shouldn't be necessary to duplicate it in the build system.

Modifications:

This makes sure that SwiftPM does not explicitly ask the compiler to link against a particular C++ stdlib.

Result:

Projects that use libc++ on Linux build correctly with SwiftPM.

rdar://141047307

This makes sure that SwiftPM does not explicitly ask the compiler to link against a particular C++ stdlib.

The Swift compiler has recently introduced support for building with C++ stdlibs which aren't the default on the target platform, specifically libc++ on Linux. The Swift Driver has logic to determine which C++ stdlib should be used, depending on the target and explicit `-Xcc -stdlib=xyz` flags, and link against the requested standard library. Similar functionality exists in Clang Driver. We should defer the C++ stdlib selection to the compiler driver, it shouldn't be necessary to duplicate it in the build system.

rdar://141047307
@egorzhdan
Copy link
Contributor Author

@swift-ci please test

@egorzhdan egorzhdan requested a review from Xazax-hun December 6, 2024 18:39
@egorzhdan
Copy link
Contributor Author

@swift-ci please test Linux

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.

4 participants