Skip to content

grep: allow wasm32-wasip1 cargo check#53

Open
wondr-wclabs wants to merge 1 commit into
uutils:mainfrom
wondr-wclabs:codex/wasm32-wasip1-check
Open

grep: allow wasm32-wasip1 cargo check#53
wondr-wclabs wants to merge 1 commit into
uutils:mainfrom
wondr-wclabs:codex/wasm32-wasip1-check

Conversation

@wondr-wclabs
Copy link
Copy Markdown
Contributor

Fixes #20.

onig_sys builds bundled C sources, so cargo check --target wasm32-wasip1 currently fails unless the caller also provides a C WASI sysroot. That makes the Rust target check depend on external C toolchain setup before the uu_grep crate 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, and cargo clippy --target wasm32-wasip1 --workspace -puu_grep -- -D warnings. I also tried cargo test --target wasm32-wasip1 --no-run; that currently stops in the dev-dependency stack because socket2 does not support the target, so I left this PR scoped to the reported cargo check failure.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jun 5, 2026

Merging this PR will not alter performance

✅ 10 untouched benchmarks
⏩ 17 skipped benchmarks1


Comparing wondr-wclabs:codex/wasm32-wasip1-check (740b302) with main (d28bf76)

Open in CodSpeed

Footnotes

  1. 17 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cargo check for wasm32-wasip1 fails

1 participant