Turn WASI apps into native executables
The approach is similar to WasmBoxC
or RLBox
:
WASM file
🠖 WASM to C translator
🠖 platform C compiler + libuvwasi + libuv
🠖 native executable
# Single step:
export CC="clang-12"
export LDFLAGS="-fuse-ld=lld"
./build.sh ./examples/coremark.wasm
# Cross-compile with Zig CC: x86_64-windows-gnu, x86_64-linux-gnu, x86_64-macos-gnu
CC="zig cc -target x86_64-linux-musl" ./build.sh ./examples/coremark.wasm
# Cross-compilation to other architectures
# For full targets list: zig targets | jq .libc
CC="zig cc -target aarch64-linux-musl" ./build.sh ./examples/hello.wasm
qemu-aarch64-static hello.elf
Hello from WebAssembly!
Note: this tool can be used for building WASI
apps, not emscripten
-generated wasm+js
output.
Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz, single-thread:
zig
CFLAGS
, overriding optimization flagslibuv
and uvwasi
for major platforms)This project is released under The MIT License (MIT)