-
Notifications
You must be signed in to change notification settings - Fork 721
fix: Fix NIOCore build for wasm targets #3156
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
fix: Fix NIOCore build for wasm targets #3156
Conversation
|
Amazing, thanks so much and sorry for missing wasm! |
| } | ||
| } | ||
| } | ||
| #elseif arch(arm) || arch(i386) || arch(arm64_32) |
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.
If this only matters the pointer size, _pointerBitWidth(_64) and _pointerBitWidth(_32) might be better choice
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.
+1, otherwise it misses plenty of other 32-bit architectures that in theory could be supported in the future.
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's up to the NIO folks but
_pointerBitWidth*is underscored and we have non-underscored alternatives (but yes, they're annoying)- mixed platforms like
arm64_32need to fall into the correct place, which in this case would be true (assuming that_pointerBitWidth(_32)is true forarm64_32
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.
My gut feeling is to avoid the underscored APIs. If it becomes necessary to support more 32-bit architectures in the future then we should push to get a non-underscored API.
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.
Sounds like the consensus is stick with || arch(wasm32). I'll leave as-is unless someone voice opinions otherwise. Happy to change this if desired, though.
I tried out adding || _pointerBitWidth(_32) instead of || arch(wasm32), and that also worked, just as a data point.
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.
Friendly ping @glbrntt to approve & merge
@weissi No worries at all - pretty hard to catch them all. I meant to mention, I was impressed with that nice |
Head branch was pushed to by a user without write access
339d6db to
f2cddc5
Compare
glbrntt
left a comment
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.
Thank you!
|
FWIW I just opened a PR to set up CI for Wasm SDK #3159 |
Fixes NIOCore compiler errors for the
wasm32architecture.Motivation:
When compiling NIOCore for a Swift WebAssembly target, several compilation errors such as the following occur:
The compilation errors were introduced with the following change:
https://github.com/apple/swift-nio/pull/2598/files#diff-a041d0c0d50a8f4fcda2020eeb4450ea994920ef61653cc06014457ccdb3ba0cR70
Modifications:
The fix is straight-forward and unlikely to affect any existing compilation targets other than the
wasm32target.We simply need to add
arch(wasm32)to compiler architecture condtions for a new typedef on line, then NIOCore compiles to wasm32 again.Result:
Before: NIOCore wasm build fails ❌
After: NIOCore wasm build succeeds ✅