To build the rust stdlib for Emscripten with emscripten-wasm-eh:
./main.sh <emscripten-version> <rust-version><rust-version> can be either a nightly date (YYYY-MM-DD) or a released
stable version (X.Y.Z).
Nightly, e.g.:
./main.sh 3.1.74 2025-02-01Stable, e.g.:
./main.sh 3.1.74 1.85.0The resulting archive is named emcc-<emscripten-version>_<channel>-<rust-version>.tar.bz2,
e.g. emcc-3.1.74_nightly-2025-02-01.tar.bz2 or emcc-3.1.74_stable-1.85.0.tar.bz2.
There are two other options that would seem better:
-Zbuild-std- Build a custom sysroot with https://github.com/RalfJung/rustc-build-sysroot/ or https://github.com/DianaNites/cargo-sysroot/.
-Zbuild-std doesn't work with panic=abort (rust-lang/cargo#7359) or with
cargo freeze. Building a custom sysroot with rustc-build-sysroot or
cargo-sysroot works with cargo freeze but has the same problem with
panic=abort. Thus, I think the only reasonable way to go is to build the
sysroot from the rust source directory.