fix: explicitly export __heap_base for wasm-bindgen thread support#680
__heap_base for wasm-bindgen thread support#680Conversation
Rust nightly removed the automatic export of __heap_base from wasm targets. wasm-bindgen CLI needs this symbol when preparing the module for threading (to inject thread IDs). Adding --export=__heap_base to the linker args fixes the "failed to find __heap_base" error. Ref: rust-lang/rust@b594ef3 Agent-Logs-Url: https://github.com/cunarist/rinf/sessions/d27d942d-2ccd-46e0-9223-f5cae25d8eff Co-authored-by: temeddix <66480156+temeddix@users.noreply.github.com>
temeddix
left a comment
There was a problem hiding this comment.
Please mention whether docs should be updated. If the CI tests pass, are we good?
No docs update needed — this is a purely internal build configuration change (adding a linker export flag). Users don't interact with this directly; |
|
@copilot Please fix the broken CI |
Agent-Logs-Url: https://github.com/cunarist/rinf/sessions/1b52453d-abd2-4e98-8261-efc1dd966d97 Co-authored-by: temeddix <66480156+temeddix@users.noreply.github.com>
|
@copilot We should support Rust 1.88 and above. Refer to the docs |
Agent-Logs-Url: https://github.com/cunarist/rinf/sessions/b173955e-d169-4282-8e9c-44ece88a8cf8 Co-authored-by: temeddix <66480156+temeddix@users.noreply.github.com>
Fixed in 2298f5f. Reverted CI workflows back to Rust 1.88. The wasm-pack compilation issue is now resolved by using |
|
@copilot Should we require Rust 1.91 and update the docs instead? |
No, I don't think we need to bump to 1.91. The only thing requiring 1.91 is compiling |
Changes
Fixes the wasm build failure when running
rinf wasmon newer Rust nightly toolchains:Root Cause
Rust nightly removed the automatic export of
__heap_basefrom wasm targets in this commit:rust-lang/rust@b594ef3
The
wasm-bindgenCLI relies on finding__heap_basein the wasm module's exports when preparing the module for threading support. Since rinf's wasm build enables threading via+atomicsand--shared-memory, this symbol is required.Fix
Explicit linker export: Added
-C link-arg=--export=__heap_baseto theRUSTFLAGSused during wasm compilation. This ensures the symbol remains exported regardless of Rust toolchain version.Install wasm tools with nightly: Changed
cargo installforwasm-packandwasm-bindgen-clito usecargo +nightly install. This is needed becausewasm-pack v0.15.0depends oncargo-platform@0.3.3which requires rustc 1.91, while the project supports Rust 1.88+. Since nightly is already required for the wasm build itself, using it to compile the build tools maintains backward compatibility with stable Rust 1.88.Before Committing
Please make sure that you've analyzed and formatted the files.