Cross-compile rustfs (github.com/rustfs/rustfs, a MinIO-class erasure-coded
S3 store, ~1070-crate lock incl. datafusion) to wasm32-wasmer-wasi and run
its CLI under wasmer. Built with -p rustfs, no-default-features (drops the
deeply-unix ftps/webdav servers), and a fast release profile override: the
stock opt3+thin-LTO+cgu1 whole-program link on a ~190MB wasm froze for 1h+.
Source mods (patches applied post-vendor so .rs edits don't re-vendor):
- rustfs-manifest.patch: switch the whole rustls stack off native aws-lc-rs
onto pure-Rust ring (AWS SDK, google-cloud, reqwest, vaultrs, lapin, mysql,
nats, mqtt, otlp, libunftp, jsonwebtoken); drop mimalloc; stub tokio signal.
- rustfs-code.patch: wasi arms for the storage core (rustfs is a filesystem:
os get_info/same_disk/device-ids, O_DIRECT, statvfs, MetadataExt, device
major/minor), mimalloc FFI gating, ring provider call sites, a 5GiB usize
overflow on wasm32.
Dependency crate-patches (stock upstream, applied by the vendor-patch hook):
tokio (net/fs guard + I/O-driver ENOTSUP), getrandom, netif,
rustls-native-certs, symlink, crc-fast, clocksource, async-rs, tonic,
tokio-postgres, deadpool-postgres, google-cloud-auth, rustfs-kafka, and the
two runtime fixes below.
Runtime blockers found by the smoke tests and fixed at the source quirk:
- wasite: whoami read the OS username via the WASI preview-2 wasi:cli
environment interface, which a preview1 host cannot import; read std::env.
- parking_lot_core: its atomic wasm parker was gated behind the cargo
`nightly` feature, so wasix (which has atomics) fell to a panic stub; select
wasm_atomic.rs on wasi.
- tokio I/O driver: wasmer's poll_oneoff returns ENOTSUP (not EINVAL) for an
empty subscription set, which tokio's wasi arm did not catch; accept it too.
wasmer root cause tracked in WASIX-TODO.md.
Tests: two mkWasixRun smoke tests (rustfs --version / --help) run the wasm
under wasmer and pass cleanly (correct output, exit 0, no panics). server/info
are not yet tested (server needs mio's unimplemented wasip1 Waker).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
No description provided.