swiftwasm / swift

WebAssembly support for the Swift programming language
https://swiftwasm.org
1.28k stars 28 forks source link

Support swift-corelibs-libdispatch #5565

Open kateinoigakukun opened 4 months ago

kateinoigakukun commented 4 months ago

We will be able to support it after https://github.com/swiftwasm/swift/issues/5548

Kyle-Ye commented 4 months ago

Running into dispatch compiler issue recently. Looks like dispatch is currently not supported on WASM.

In file included from /home/runner/work/OpenGraph/OpenGraph/Sources/_OpenGraph/Graph/Graph.cpp:9:
In file included from /opt/hostedtoolcache/swiftwasm/wasm-5.9.1-RELEASE/x86_64/usr/lib/swift_static/dispatch/dispatch.h:64:
/opt/hostedtoolcache/swiftwasm/wasm-5.9.1-RELEASE/x86_64/usr/lib/swift_static/os/object.h:221:1: error: unknown type name '__BEGIN_DECLS'
__BEGIN_DECLS
Kyle-Ye commented 4 months ago

Does it mean #if defined(__unix__) is not evaluated to true for WASI and we need to a PR to fix it here?

https://github.com/apple/swift-corelibs-libdispatch/blob/5529d351e304eb2312b7b3bfb073f7d8285473e0/os/object.h#L24-L33

kateinoigakukun commented 4 months ago

libdispatch is not supported yet at all

Kyle-Ye commented 4 months ago

libdispatch is not supported yet at all

Got it. I'll use macro to disable it for WASI platform.

https://github.com/OpenSwiftUIProject/OpenGraph/blob/d35513b213be037fe97995b1704020b837a4a9e8/Sources/_OpenGraph/Graph/Graph.cpp#L21-L29