Krad is a four-crate Rust workspace for producing small, standard WebAssembly modules without a JavaScript runtime:
krad-clangdrives an explicit LLVM/Clang WebAssembly compiler and also exposes its own tiny Wasm ABI marker.krad-muslprovides allocator-free memory and string primitives.krad-libsprovides Linux/FreeBSD errno, page, and copy helpers.krad-utilsprovides the build CLI and a small Wasm utility ABI.
Build every Rust crate plus the real C++ fixture with a Clang that supports the WebAssembly target. The compiler path is explicit; the Krad CLI never downloads or extracts a toolchain:
cargo run -p krad-utils -- build dist /path/to/wasi-sdk/bin/clang++The command creates five raw, import-free modules:
dist/krad-add.wasm
dist/krad-clang.wasm
dist/krad-libs.wasm
dist/krad-musl.wasm
dist/krad-utils.wasm
krad-add.wasm is compiled from examples/add.cpp with the standard
wasm32-unknown-unknown target, -nostdlib, and an explicit krad_add export.
The checked-in artifact was built with the SHA-verified official WASI SDK 33
archive and Clang 22.1.0. The other four modules are Rust wasm32v1-none
release builds. The CLI uses Bytecode Alliance's pinned wasmparser to reject
invalid modules, imports, and missing function exports before replacing an
artifact directory as one set. Existing output is replaced only when it carries
Krad's .krad-artifacts ownership marker; concurrent builds serialize on a
sibling lock file.
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
node -e "WebAssembly.instantiate(require('node:fs').readFileSync('dist/krad-add.wasm')).then(({instance})=>{if(instance.exports.krad_add(20,22)!==42)process.exit(1)})"Krad is not a complete libc, sysroot, browser-hosted compiler, Linux/BSD distribution, or native-ISA translator. It makes no performance or size claim without a comparable benchmark.
Krad is MIT-licensed; see LICENSE.