Describe the bug
This is more of a UX/docs issue, but might be worth tackling before the v2 release?
I built the CLI with --no-default-features:
- With the current beta of v2, this cargo option now strips away the actual subcommands. Results in a CLI that can only output help regarding
--help/--version and supports nothing else.
- Features
wasi and wat had no increase on binary size. They appear dependent on the new subcommand related features to be present?
Those UX concerns could potentially be better by introducing build failures if they serve no practical purpose (effectively misconfigured build).
Expected behavior
As a newbie that isn't that familiar with the Wasmi project (or really using wasm at all), but someone who is interested in customizing builds, it'd be helpful to better communicate when feature opt-out / opt-in choices are not practical.
If wasi and wat features are dependent upon the new command features run/wast, perhaps that should have a build.rs guard to trigger a build failure when run/wast are not present? (here is an example reference from the cudarc crate that does this)
Likewise, there may not be much sense in --no-default-features when building the CLI if not a single subcommand feature is added back? At least I'm not sure of the value building a CLI that only supports --help/--version?
Up to you what makes sense, this is just an issue to provide feedback where I went on a detour from:
- Producing a minimal CLI build that turns out to not do anything with recent v2 changes (understandable).
- Misunderstanding that
wasi/wat were enabled when they were dependent upon subcommand features.
Reproduction
- What Wasmi version was used?
v2.0.0-beta.0 (Commit: ce21848)
- Bug occurs on Wasmi CLI or Wasmi library? CLI
- Ideally please provide minified Wasm (
.wasm) or Wat (.wat) file to reproduce. None
For reference this is how I built the CLI with a minimal footprint and observed impact on size by features (only bothering with the default set):
# Setup environment via Docker:
docker run --rm -it --workdir /wasmi fedora:43
dnf install -yq rustup gcc git
rustup-init -y --profile minimal --default-toolchain stable --target x86_64-unknown-linux-musl && . "$HOME/.cargo/env"
rustup toolchain install nightly --component rust-src
# Optional: `x86_64-unknown-linux-musl` target nightly `-Z build-std` support:
dnf install -yq musl-gcc
rustup target add x86_64-unknown-linux-musl --toolchain nightly
git clone --depth 1 https://github.com/wasmi-labs/wasmi .
# Reference 4.96MB (Rust 1.93.1) or 4.8MB (1.95.0-nightly 2026-02-11):
RUSTFLAGS='-C strip=symbols' cargo build --package wasmi_cli --profile bench
# 2.6MB:
# (NOTE: `--features` value varies as per associated notes that follow)
RUSTFLAGS='-C strip=symbols -C opt-level=z -C relocation-model=static -Z unstable-options -C panic=immediate-abort' \
cargo +nightly build --package wasmi_cli --profile bench \
-Z build-std=core,std,panic_abort \
-Z build-std-features=optimize_for_size \
--target x86_64-unknown-linux-gnu \
--no-default-features \
--features run,wasi,wast,wat \
--quiet
Observed differences:
--features run produces a 930KB binary.
--features wast produces a 1.93MB binary (+1MB).
--features wast,run produces a 1.97MB binary (run effectively only adds 40KB).
--features wat is additive to size only when run or wast is enabled (+320/350 KB).
--features wasi is only additive when run is enabled (+300KB).
- All 4 features enabled produces a 2.6MB binary.
Given those observations... The wat feature should probably be dependent upon run/wast features then? And wasi dependent upon the run feature?
Describe the bug
This is more of a UX/docs issue, but might be worth tackling before the v2 release?
I built the CLI with
--no-default-features:--help/--versionand supports nothing else.wasiandwathad no increase on binary size. They appear dependent on the new subcommand related features to be present?Those UX concerns could potentially be better by introducing build failures if they serve no practical purpose (effectively misconfigured build).
Expected behavior
As a newbie that isn't that familiar with the Wasmi project (or really using wasm at all), but someone who is interested in customizing builds, it'd be helpful to better communicate when feature opt-out / opt-in choices are not practical.
If
wasiandwatfeatures are dependent upon the new command featuresrun/wast, perhaps that should have abuild.rsguard to trigger a build failure whenrun/wastare not present? (here is an example reference from thecudarccrate that does this)Likewise, there may not be much sense in
--no-default-featureswhen building the CLI if not a single subcommand feature is added back? At least I'm not sure of the value building a CLI that only supports--help/--version?Up to you what makes sense, this is just an issue to provide feedback where I went on a detour from:
wasi/watwere enabled when they were dependent upon subcommand features.Reproduction
v2.0.0-beta.0(Commit: ce21848).wasm) or Wat (.wat) file to reproduce. NoneFor reference this is how I built the CLI with a minimal footprint and observed impact on size by features (only bothering with the default set):
Observed differences:
--features runproduces a 930KB binary.--features wastproduces a 1.93MB binary (+1MB).--features wast,runproduces a 1.97MB binary (runeffectively only adds 40KB).--features watis additive to size only whenrunorwastis enabled (+320/350 KB).--features wasiis only additive whenrunis enabled (+300KB).Given those observations... The
watfeature should probably be dependent uponrun/wastfeatures then? Andwasidependent upon therunfeature?