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.
If this only matters the pointer size, _pointerBitWidth(_64) and _pointerBitWidth(_32) might be better choice
There was a problem hiding this comment.
+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.
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.
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.
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.
@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
|
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 ✅