fix: wasm32-wasip2 build fails to link the WASI signal emulation by JMLX42 ¡ Pull Request #10028 ¡ RustPython/RustPython
Repository navigation
fix: wasm32-wasip2 build fails to link the WASI signal emulation - #10028
Merged
youknowone merged 2 commits into RustPython:main from JMLX42:wasip2-emulated-signal Nov 26, 2026
Merged
fix: wasm32-wasip2 build fails to link the WASI signal emulation #10028 youknowone merged 2 commits into RustPython:main from JMLX42:wasip2-emulated-signal
Conversation
JMLX42
commented
Nov 26, 2026
·
edited by coderabbitai
Bot
Loading
Copy link Copy Markdown
Contributor
One of checkbox below must be checked.
- I did not use AI to write the code of this patch.
- This PR follows our AI policy
Summary
Follow-up to #8986 . Since that change, rustpython-host_env declares signal, raise, __SIG_IGN and __SIG_ERR on every WASI target. libwasi-emulated-signal.a, which defines them, is linked only from this repository's .cargo/config.toml, and only for wasm32-wasip1. That leaves two gaps:
wasm32-wasip2does not link. CI only runscargo checkfor that target, andcargo checkdoes not link, so CI stays green.- Crates that depend on
rustpython-vmget no link flag on either target, because Cargo never reads a dependency's.cargo/config.toml.
Reproduction at 9080e66 with Rust 1.100.0:
$ cargo build --locked --target wasm32-wasip2 --no-default-features \
--features freeze-stdlib,stdlib,stdio,importlib,host_env,doc,ucd_3_2_0
= note: rust-lld: error: ...librustpython_host_env-....rlib(...): undefined symbol: __SIG_IGN
rust-lld: error: ...: undefined symbol: __SIG_ERR
rust-lld: error: ...: undefined symbol: raise
rust-lld: error: ...: undefined symbol: signal
error: could not compile `rustpython` (bin "rustpython") due to 1 previous error
Change
crates/host_env/build.rsemitscargo:rustc-link-search=native=<manifest dir>/vendor/<target>andcargo:rustc-link-lib=static=wasi-emulated-signalforwasm32-wasip1andwasm32-wasip2, before itswasm32early return. The static archive is bundled into the rlib, so dependent crates link it with no setup of their own.crates/host_env/vendor/wasm32-wasip2/libwasi-emulated-signal.acomes from the same wasi-sdk-34 sysroot as the existingwasm32-wasip1copy (lib/wasm32-wasip2/libwasi-emulated-signal.a, sha25649b9844a3a29ea00e4adb58338bbf7ef8f2053078646e78c77ac9a2952deebf6). Its objects are position-independent; otherwise they match the wasip1 ones (same clang, target features and imports)..cargo/config.tomldrops thewasm32-wasip1-L/-lpair, which the build script now covers.- A second commit adds a step to the
wasm32-wasip2entry of CI'scargo checkmatrix that runs thewasm32-wasip2build above, so CI links that target.
Testing
With Rust 1.100.0:
- The
wasm32-wasip2build above, which the new CI step runs, links. It failed before the change. Thewasm32-wasip1build still links, now through the build script alone. extra_tests/snippets/stdlib_signal.pypasses on both binaries under wasmtime 47.0.4.- A
wasm32-wasip2component that depends onrustpython-vmby git, withhost_env, links with no linker flags of its own, andsignal.raise_signal(signal.SIGINT)runs a Python handler in it. - On
x86_64-unknown-linux-gnu: the test and Clippy commands fromAGENTS.md(workspace, andcrates/capi), CI's Clippy step with-Dwarnings, andcargo fmt --checkall pass.
AI assistance
The investigation, the patch and this description were produced with Claude Code (claude-opus-5-5). I reviewed the diff, ran the wasm32-wasip2 and wasm32-wasip1 builds myself, and ran the signal snippet, a negative control and a SIGINT handler check on both binaries under wasmtime. Both commits carry an Assisted-by trailer.
đ¤ Written by Claude Code (2.1.332) using model claude-opus-5-5
Summary by CodeRabbit
- Bug Fixes
- Improved signal-emulation support for builds targeting WASI Preview 1 and Preview 2.
- Tests
- Added a locked build check for WASI Preview 2.
- Documentation
- Clarified signal-emulation support across WASI targets and documented the Preview 2 archive's source, license, and checksum.
fix: wasm32-wasip2 build fails to link the WASI signal emulation
154ceb9
Follow-up to RustPython#8986. - Problem: linking for wasm32-wasip2, or linking any crate that depends on rustpython-host_env for a WASI target, fails with undefined symbols signal, raise, __SIG_IGN and __SIG_ERR - Cause: libwasi-emulated-signal is linked only from the workspace's .cargo/config.toml, only for wasm32-wasip1; Cargo never applies a dependency's config file, and host_env's build.rs returns early on wasm32. CI only runs cargo check for wasm32-wasip2, which does not link - Fix: vendor the wasm32-wasip2 build of the library from the same wasi-sdk-34 sysroot, and link it from host_env's build.rs for wasm32-wasip1 and wasm32-wasip2. The static library is bundled into host_env's rlib, so dependents need no linker flags. Drop the -L/-l flags from .cargo/config.toml Assisted-by: Claude Code:claude-opus-5-5
chatgpt-codex-connector
Bot
commented
Nov 26, 2026
Copy link Copy Markdown
|
Codex Review Summary : â Failed
This comment shows the latest Codex review activity on this pull request.
Your team has set up Codex to review pull requests in this repo . Reviews are triggered when you
Codex reacts with đ while any review is running, comments if it has suggestions, and reacts with đ once all reviews finish with no findings. |
chatgpt-codex-connector
Bot
commented
Nov 26, 2026
Copy link Copy Markdown
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
coderabbitai
Bot
commented
Nov 26, 2026
·
edited
Loading
Copy link Copy Markdown
Contributor
|
No actionable comments were generated in the recent review. Walkthrough
2afb6
Thanks for using CodeRabbit ! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Share
Recent review info
Run configuration
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. |
ci: link the wasm32-wasip2 build
2afb620
The wasm32-wasip2 entry of the cargo check matrix only runs cargo check, which does not link, so the undefined signal symbols fixed in the previous commit passed CI. Build the rustpython binary for wasm32-wasip2 in that entry, with the features the wasm-wasi job uses. Assisted-by: Claude Code:claude-opus-5-5youknowone reviewed Nov 26, 2026
View reviewed changes
Comment thread crates/host_env/vendor/wasm32-wasip2/libwasi-emulated-signal.a youknowone approved these changes Nov 26, 2026
View reviewed changes
youknowone left a comment
Copy link Copy Markdown
Member
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more .
ok, found no better way. Thanks!
youknowone merged commitaf6db81
into
RustPython : main
Nov 26, 2026
28 checks passed
coderabbitai
Bot
mentioned this pull request Dec 2, 2026 [WIP] Wire WASI p2 sockets and prepare preview1 descriptor adapters #9889 Draft Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment