Building from source
Requirements
Section titled “Requirements”- Rust nightly (wackasm uses nightly features), with the
wasm32-unknown-unknownandwasm32-wasip1targets:rustup target add wasm32-unknown-unknown wasm32-wasip1; patch-crate, which providescargo patch-crate(cargo install patch-crate). The interpreter builds against a patchedwasmparser(patches/), applied withcargo patch-crate;- JDK 21 or newer, to run Gradle (ModDevGradle) and build for Minecraft 1.21.1;
- Node.js 22 or newer, for these docs.
Layout
Section titled “Layout”The BIOS, shell and programs build for wasm only, so they’re separate cargo workspaces.
The mod
Section titled “The mod”build runs cargo for the native library, the BIOS, the shell and the
programs (natives.gradle), then packages them: the library under
natives/<os>-<arch>/, the BIOS as assets/wackasm/bios.wasm, and the
floppy under assets/wackasm/loot/shell/. It fails if the BIOS outgrows a
4096-byte EEPROM. -Pskip_cargo=true packages what is already built.
Recipes are data in 1.21, and the BIOS’s bytes are part of the EEPROM
recipe’s result, so generateRecipes writes both recipes from the built
BIOS. They must make the same items as the Items.registerEEPROM and
Items.registerFloppy calls in WackasmMod.
The jar contains the native library for the platform it was built on. For a
multi-platform jar, put other platforms’ builds in
mc-mod/natives-extra/<os>-<arch>/ first (for example
linux-x86_64/libwackasm_oc.so). The release workflow does this.
Without Minecraft
Section titled “Without Minecraft”The headless example runs a computer against simulated components: an
EEPROM, a GPU and screen, a keyboard that types a script, a disk backed by a
host directory, and optionally an internet card that makes real connections.
./disk needs the shell as init.wasm and programs in bin/. In --keys,
\r is Enter, \b backspace and \d Ctrl+D. The machine is saved and
reloaded every few slices, which exercises suspension. At the end it prints
the screen and counts of the calls made.
The docs
Section titled “The docs”The site links to the Rust API docs at /wackasm/rustdoc/, which CI builds
and adds after the Starlight build. To preview them locally, build them and
copy them into docs/public/ (ignored by git):
rustdoc’s links are all relative, so its output works under any path.