-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[stdlib] Use the single-header Glibc modulemap. #40557
Conversation
cc @compnerd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you use gyb at all at this point? Why not use CMake to generate the module map? Is there a reason that glibc is still referenced? I think that it makes sense to rename the include header for O/BSD
I hope I understood your questions, please clarify as necessary.
Fair enough, we don't need gyb on the
We still call the module
Does it? Wasn't the idea in #32404 was to use a common header, or am I reading that intent wrongly? We could fork We could alternatively remove |
I still strongly disagree with having Having the separate paths here I think is a net positive - we can clearly see what different targets are doing and what paths they are going down. As to the gyb vs cmake - I am slightly partial to CMake because AIUI, the reason that the header form was used was to avoid injecting the path to the headers into the module map allowing reuse outside of the original build. This is a good thing, and something we should support, but I am not sure if this is much better. Injecting into system paths is not so terrible, and that allows using of relative paths. |
Yeah, it's not ideal. We have @millenomi's
So -- let me confirm -- it sounds like you want a static |
Yes, I think that would be better than the current state of things. Still, less than ideal, but renaming the module for O/BSD doesn't have to be part of this change. |
153809c
to
471d062
Compare
Done. |
//===----------------------------------------------------------------------===// | ||
|
||
/// Partial modulemap for libc on OpenBSD. | ||
module SwiftGlibc [system] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point, why even have a separate OpenBSD modulemap, why not generate it from glibc.modulemap.gyb
as the other platforms are doing, including my move to do the same with Bionic in #35707? I know you said "adding yet more conditionals to that modulemap impacts readability," but I don't see that simple file becoming a problem if you add OpenBSD to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, it's not too bad with only a few platforms supported, but as that grows, the conditionals become more complicated and the modulemap harder to reason about. Additionally, if we want to get to a point eventually where each libc has its own module, then we would probably want to have separate platform modulemaps anyway as it'll look cleaner in the wash.
I'm happy to do whatever, ultimately, and we can cross those bridges when we come to them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I'd prefer if you just used that common glibc gyb file for now, but not a big deal either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@compnerd, wdyt about that option.
I agree with Saleem that we should distinguish between the different C libraries with better naming, but as @3405691582 noted that effort is currently unapproved and most ported Swift libraries have code like this, that use the Glibc naming for C libraries that aren't glibc. Fixing that will take that CStdlib pitch passing first or starting to name the different C libraries from these modulemaps properly, then we will need to update those Swift libraries. |
It is more than just naming. The gyb file is nearly illegible because there are differences between the libcs. Similar to the naming issue - why not just follow the design of the MSVC VisualC library? The C standard doesn't mandate enough to derive the module map definition from that. Additionally, there are plenty of extensions in the various different C libraries, which differ both in implementation and in coverage, that it really does make it far more difficult to make changes. There is no need for approval for splitting out the files into separate files - we are not changing the behaviour, only the implementation. Even with the modulemaps renamed, the name of the module is controlled by the name within the modulemap definition, and while I would love to see that renamed, I can understand that bit remaining the same until we do have an evolution proposal. |
This gyb file? Hardly makes a difference to me, and I think it's easier to maintain than having several separate files, but again this is just personal preference.
Right, that was the only name I was referring to above with "we should distinguish between the different C libraries with better naming," as with the example I linked to in Foundation. |
Unfortunately, I have run into a problem with this change. When building ReleaseAssert and Foundation:
This does not happen with the old modulemap. I'll have to investigate further. I'll ping the pr back when this is resolved. |
Try the fix I applied for my similar pull for Bionic, given to me by Alexis when I hit an almost identical error. |
471d062
to
d872e75
Compare
Thanks, that's very helpful. Added. I don't think it makes a lot of sense to have that particular conditional for the |
@3405691582, you'll need to |
d872e75
to
660fa28
Compare
#40774 being merged means OpenBSD builds won't complete at HEAD. Are we in a position to merge or is anything else required for this pr? |
@compnerd, can we get this in? |
@CodaFi, would you review? |
Ping, it would be nice to get this merged in some form to solve the buildbreak. Please let me know if any other changes are desired here. |
Sorry, you'll need to give this one more rebase since I merged @buttaface's PR |
660fa28
to
aba84e9
Compare
This migrates OpenBSD to use the single-header Glibc modulemap proposed and implemented in swiftlang#32404, and necessitates introducing some missing headers for building Foundation added in swiftlang#38341. Additionally, incorporate nullability annotations in SwiftShims per
aba84e9
to
600d500
Compare
Done and done. |
@MaxDesiatov, would you run the CI on this? |
@swift-ci please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll submit for the 5.6 branch along with my Bionic cleanup, once this is in trunk.
@swift-ci smoke test Linux platform |
Linux CI failures appear to be flakes. |
@swift-ci clean smoke test Linux platform |
Another Linux CI flake: single integration test failed when searching for shared libraries with error |
@CodaFi, I think you can go ahead and merge, this pull is mostly only going to affect OpenBSD. |
I can't merge without blue bots @swift-ci clean smoke test Linux platform |
Failed in three minutes, didn't even start because the CI flaked. |
@swift-ci clean smoke test Linux platform |
This migrates OpenBSD to use the single-header Glibc modulemap proposed
and implemented in #32404, and necessitates introducing some missing
headers for building Foundation added in #38341.
(This was tested by building Swift and the corelibs on OpenBSD including necessary unmerged prs swiftlang/swift-corelibs-libdispatch#559 and swiftlang/swift-corelibs-foundation#3004.)