swift-nio icon indicating copy to clipboard operation
swift-nio copied to clipboard

Add support for WASILibc

Open MaxDesiatov opened this issue 1 year ago • 5 comments

Dispatch is not supported on WASI, and only Unix domain sockets are supported, which means we have to exclude those APIs on this platform.

There's work in progress to enable tests for this on CI, but nothing I can provide for this PR at the current moment.

MaxDesiatov avatar Mar 04 '24 14:03 MaxDesiatov

@swift-server-bot add to allowlist

Lukasa avatar Mar 08 '24 15:03 Lukasa

@MaxDesiatov / @Lukasa This looks like a PR that has bit rotting potential because it needs to touch a lot of pieces, most of the issues seem pretty tractable to me so I'd love to see this go in.

w.r.t. disabling locks on WASI: Honestly I think this can go in as is: Today this is fine and if threading really happens this will blow up very obviously and can be fixed.

weissi avatar Apr 09 '24 22:04 weissi

Currently blocked on https://github.com/swiftlang/swift/pull/75618, which would make PF_INET and PF_INET6 available.

MaxDesiatov avatar Aug 01 '24 14:08 MaxDesiatov

Currently blocked on swiftlang/swift#75618, which would make PF_INET and PF_INET6 available.

You can just hardcode the values for the time being, right? They are #defines and therefore ABI, so they can't change.

weissi avatar Aug 01 '24 17:08 weissi

Currently blocked on swiftlang/swift#75618, which would make PF_INET and PF_INET6 available.

You can just hardcode the values for the time being, right? They are #defines and therefore ABI, so they can't change.

If that version bump is easy and we get it done quickly, I'd rather have that one merged and make this PR cleaner at the same time.

MaxDesiatov avatar Aug 01 '24 17:08 MaxDesiatov

With changes I've pushed the build is now successful with latest development snapshots when building NIOCore and NIOHTTP1 targets for single-threaded WASI.

MaxDesiatov avatar Sep 04 '24 16:09 MaxDesiatov

Pushed more changes so that it uses wasi_pthread when multi-threading is available with wasm32-unknown-wasip1-threads triples.

MaxDesiatov avatar Sep 04 '24 16:09 MaxDesiatov

w.r.t. disabling locks on WASI: Honestly I think this can go in as is: Today this is fine and if threading really happens this will blow up very obviously and can be fixed.

@weissi In this PR we now conditionally enable locks when those are available in WASI.

MaxDesiatov avatar Sep 04 '24 16:09 MaxDesiatov

CC @FranzBusch & @Lukasa

weissi avatar Sep 09 '24 14:09 weissi