grep: allow wasm32-wasip1 cargo check#53
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
|
Can we build oniguruma for wasip1? or remove oniguruma from all platforms for simplicity? |
|
Thanks for tackling this! I'd rather not drop Oniguruma on WASI - it forks the matcher and loses We don't need to: the uutils playground already builds grep for Could you redo it that way? Drop the WASI_SDK_DIR="wasi-sdk-25.0-x86_64-linux"
curl -sL "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/${WASI_SDK_DIR}.tar.gz" | tar xz
export WASI_SDK_PATH="$PWD/${WASI_SDK_DIR}"
export CC_wasm32_wasip1="$WASI_SDK_PATH/bin/clang"
export CFLAGS_wasm32_wasip1="--sysroot=$WASI_SDK_PATH/share/wasi-sysroot"
cargo check --target wasm32-wasip1That keeps one matcher, real regex on WASI, and a green check. Thanks! |
|
Can we enable |
|
probably, yes |
|
Yes |
Fixes #20.
onig_sysbuilds bundled C sources, socargo check --target wasm32-wasip1currently fails unless the caller also provides a C WASI sysroot. That makes the Rust target check depend on external C toolchain setup before theuu_grepcrate itself is checked.This PR target-gates the Oniguruma dependencies away from WASI builds and adds a small WASI matcher fallback for ASCII literal patterns. I kept the fallback intentionally narrow: non-WASI builds keep the existing Oniguruma behavior, while WASI builds return an explicit error for regex features that would require Oniguruma. Pulling in a different pure-Rust regex engine for WASI would make the command compile, but it would also create a second regex semantics path for BRE/ERE/PCRE behavior, which seems worse than failing clearly for unsupported cases.
I also added a CI job that runs the issue reproducer command directly:
cargo check --target wasm32-wasip1.Checked locally:
cargo fmt --all -- --check,cargo check,cargo test,cargo clippy --all-targets --workspace -puu_grep -- -D warnings,cargo check --target wasm32-wasip1, andcargo clippy --target wasm32-wasip1 --workspace -puu_grep -- -D warnings. I also triedcargo test --target wasm32-wasip1 --no-run; that currently stops in the dev-dependency stack becausesocket2does not support the target, so I left this PR scoped to the reportedcargo checkfailure.