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

[Swift-6.0] Workaround broken glibc modulemap #5002

Merged

Conversation

etcwilde
Copy link
Contributor

@etcwilde etcwilde commented Jul 10, 2024

We have been running into modularization issues on newer versions of various Linux distros, resulting in the compiler saying that the Glibc module doesn't have a SOCK_STREAM or SOCK_DGRAM. From some poking around, the definition is now coming from the CoreFoundation module as far as Swift is concerned. This is ultimately because our modulemap for Glibc is bad, but also means that I can't bring up Swift 6 on all of the Linux distros that 5.10 has support for.

This workaround removes the explicit module name from SOCK_STREAM and renames it to FOUNDATION_SOCK_STREAM to avoid an ambiguous name, and completely removes SOCK_DGRAM.

Both SOCK_STREAM and SOCK_DGRAM are fileprivates, so changing them will have no visible external effect. It is true that if another header somewhere defines SOCK_STREAM, we may pick it up instead of the definition from the glibc module, but that will also cause some nasty surprises to anyone using that header in C, so it is unlikely.

Fixes: rdar://128079849

Cherry-pick of: #5005

@etcwilde etcwilde requested review from parkera and xymus July 10, 2024 06:00
@etcwilde
Copy link
Contributor Author

@swift-ci please test

@etcwilde
Copy link
Contributor Author

(Thanks Alexis for the idea to just delete Glibc 😆)

@etcwilde etcwilde force-pushed the ewilde/workaround-broken-modulemap branch from 31a5e4d to 5aafde3 Compare July 10, 2024 12:49
@etcwilde
Copy link
Contributor Author

@swift-ci please test

We have been running into modularization issues on newer versions of
various Linux distros, resulting in the compiler saying that the Glibc
module doesn't have a SOCK_STREAM or SOCK_DGRAM. From some poking
around, the definition is now coming from the CoreFoundation module as
far as Swift is concerned. This is ultimately because our modulemap for
Glibc is bad, but also means that I can't bring up Swift 6 on all of the
Linux distros that 5.10 has support for.

This workaround removes the explicit module name from `SOCK_STREAM` and
renames it to `FOUNDATION_SOCK_STREAM` to avoid an ambiguous name, and
completely removes `SOCK_DGRAM`.

Both SOCK_STREAM and SOCK_DGRAM are fileprivates, so changing them will
have no visible external effect. It is true that if another header
somewhere defines `SOCK_STREAM`, we may pick it up instead of the
definition from the glibc module, but that will also cause some nasty
surprises to anyone using that header in C, so it is unlikely.

Fixes: rdar://128079849
@etcwilde etcwilde force-pushed the ewilde/workaround-broken-modulemap branch from 5aafde3 to c878f80 Compare July 10, 2024 15:37
@etcwilde
Copy link
Contributor Author

@swift-ci please test

@etcwilde
Copy link
Contributor Author

@swift-ci please test Windows

1 similar comment
@etcwilde
Copy link
Contributor Author

@swift-ci please test Windows

@parkera
Copy link
Contributor

parkera commented Jul 10, 2024

I would rather leave main and 6.0 in sync with the workaround until that workaround is ready.

@etcwilde
Copy link
Contributor Author

Alright, cherry-picking to both places until we have an actual fix in place.

@parkera
Copy link
Contributor

parkera commented Jul 16, 2024

@swift-ci test

@parkera parkera merged commit c513286 into swiftlang:release/6.0 Jul 17, 2024
2 of 3 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.

3 participants