-
Notifications
You must be signed in to change notification settings - Fork 656
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
Correct a few Musl additions from #2449 for Android, plus error if libc not found #2451
Conversation
…if libc not found Motivation Fix build errors on Android Modifications - Fix previous Musl modifications that assumed Glibc wasn't imported on Android - Add errors for all libc imports, so new platform ports error out early Result NIO builds natively on Android again, with all the same tests passing
@@ -66,7 +66,7 @@ extension NIOBSDSocket.SocketType: Hashable { | |||
extension NIOBSDSocket.SocketType { | |||
/// Supports datagrams, which are connectionless, unreliable messages of a | |||
/// fixed (typically small) maximum length. | |||
#if canImport(Glibc) | |||
#if os(Linux) && !canImport(Musl) |
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.
@MaxDesiatov, I presume this was your intent when you changed these two lines in this file.
@@ -37,7 +37,7 @@ import CNIOWindows | |||
|
|||
internal typealias MMsgHdr = CNIOWindows_mmsghdr | |||
#else | |||
let badOS = { fatalError("unsupported OS") }() |
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 have no idea why @weissi used this formulation instead of erroring, as I added now.
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.
That code was from before #error(...)
got added to Swift (or at least at a time when NIO still supported Swift versions that didn't have #error
).
@@ -111,7 +111,7 @@ private let sysIfNameToIndex: @convention(c) (UnsafePointer<CChar>?) -> CUnsigne | |||
private let sysSocketpair: @convention(c) (CInt, CInt, CInt, UnsafeMutablePointer<CInt>?) -> CInt = socketpair | |||
#endif | |||
|
|||
#if canImport(Glibc) | |||
#if os(Linux) && !canImport(Musl) |
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.
@MaxDesiatov, I don't know why you changed this for Musl, these functions aren't there? Because this change you made doesn't define them for Musl at all.
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.
@MaxDesiatov, do you define these for Musl? If so, feel free to add a commit to this pull with those Musl defintions, and we can get that fix in too.
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’m generally happy with this but would like @MaxDesiatov to confirm as well.
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.
LGTM
@swift-server-bot add to allowlist |
Motivation:
Fix build errors on Android
Modifications:
Result:
NIO builds natively on Android again, with all the same tests passing