Skip to content

Commit 1c8cb42

Browse files
committed
readme: add docs for webassembly
Signed-off-by: Tonis Tiigi <[email protected]>
1 parent ae3107c commit 1c8cb42

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,15 @@ RUN xx-cargo build --release --target-dir ./build && \
477477
xx-verify ./build/$(xx-cargo --print-target-triple)/release/hello_cargo
478478
```
479479

480+
### WebAssembly
481+
482+
`xx-cargo` can also be used to build WebAssembly targets. Use platform `wasi/wasm` on your builds for `xx` to pick up the correct configuration. If your code is compatible you can use identical Dockerfile to build Linux and WebAssembly containers.
483+
484+
When using multi-stage builds to copy build results to other stages, note that Rust adds ".wasm" suffix to the binaries built with
485+
WebAssembly.
486+
487+
Only Rust builds are supported at the moment. To build C/C++ code for WebAssembly using `xx-clang` your Dockerfile needs to set up Wasi Sysroot and `libclang-rt` itself.
488+
480489
## External SDK support
481490

482491
In addition to Linux targets, `xx` can also build binaries for MacOS and Windows. When building MacOS binaries from C, external MacOS SDK is needed in `/xx-sdk` directory. Such SDK can be built, for example, with [gen_sdk_package script in osxcross project](https://github.com/tpoechtrager/osxcross/blob/master/tools/gen_sdk_package.sh). Please consult XCode license terms when making such an image. `RUN --mount` syntax can be used in Dockerfile in order to avoid copying SDK files. No special tooling such as `ld64` linker is required in the image itself.

0 commit comments

Comments
 (0)