The finest way to "Heap exhausted, game over."!
# Install the wasm32-wasip1 toolchain
rustup target add wasm32-wasip1
# Build a test file
cargo build --target wasm32-wasip1 --release
# Produce `wasm2cl-wasm2cl-sys/`
# Functions are spread over multiple files to
# reduce the likelyhood of running out of memory
# during compilation.
cargo run --release -- target/wasm32-wasip1/release/wasm2cl.wasm wasm2cl-wasm2cl-sys;; system `wasm2cl-wasm2cl-sys` will be freshly created in `wasm2cl-wasm2cl-sys/`
;; and system `wasm2cl` is in `runtime/`
(asdf:load-system :wasm2cl-wasm2cl-sys)
(wasm2cl-wasip1:run :wasm2cl-wasm2cl-sys "--help")Run the standard conformance tests against this, ideally in CI too.
There are ports of a few libraries and programs.
They require wasi-sdk to build, tested with 33.0.
cd ports
./build.sh <path-to-wasi-sdk>This produces a few wasm files that can be translated.
ports/sysroot/games/prboomports/sysroot/bin/sdlquake
Data files for prboom available in ports/prboom-2.5.0/data/ (Doom 1 shareware WAD)
Data files for sdlquake available in ports/sdlquake-1.0.9/id1/ (Quake 1 shareware)
sdlquake triggers a miscompilation on arm64 related to specialized entry points.
This can be worked around by passing the --notinline flag to wasm2cl to
disable this SBCL functionality.