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

Workaround broken glibc modulemap #5005

Merged

Conversation

etcwilde
Copy link
Contributor

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

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
Copy link
Contributor Author

@swift-ci please test

@etcwilde etcwilde requested a review from parkera July 17, 2024 15:36
@parkera parkera merged commit 0f7e129 into swiftlang:main 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.

2 participants