WebAssembly + SwiftPM

SwiftPM with WebAssembly works well with that patch.

I already used SwiftPM to build a Swift project which is targeting for wasm32-unknown-wasi GitHub - swiftwasm/JavaScriptKit: Swift framework to interact with JavaScript through WebAssembly.

WebAssembly doesn't support linking multiple modules at runtime but wasm-ld which is a relocatable object file linker can link multiple modules at build time.

Now, Swift for WebAseembly depends on WASI and wasi-sysroot as SDK, but it's not installed in fixed absolute path, so users need to pass --sysroot flag when building.
In addition, when exporting or importing symbols with host environment, users need to pass additional flags to allow undefined symbol at link time and to export specific symbols.
(e.g. https://github.com/kateinoigakukun/JavaScriptKit/blob/master/script/build-package.sh)

FYI: Wasm Support - #14 by kateinoigakukun

7 Likes