Repository navigation
fix(wasm): declare audit host import module to fix WASM link - #38
Merged
Merged
Conversation
The `ressrf_host_audit_event` host import was declared as a bare
`extern "C"` block with no explicit `wasm_import_module`. Older
`wasm-ld` leniently treated it as an `env` import, but the newer
toolchain tightened undefined-symbol handling and fails the link with
`undefined symbol: ressrf_host_audit_event`, reddening every PR.
Add `#[link(wasm_import_module = "env")]` so the symbol is emitted as a
real WebAssembly import. The `env` module matches both host runtimes:
wazero's `NewHostModuleBuilder("env")` on the Go side and the `env`
import object on the Node side.
Regenerate the committed `core.wasm` artifacts.
Fixes #37
|
|
gonzaloserrano
approved these changes
Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #37. The Build WASM job's "Rebuild core.wasm" step fails at link with
rust-lld: error: undefined symbol: ressrf_host_audit_event, reddening every PR's CI.The
ressrf_host_audit_eventaudit host import was declared as a bareextern "C"block with no explicitwasm_import_module. Olderwasm-ldleniently treated it as an allowedenvimport, but the newer toolchain tightened undefined-symbol handling and now errors on it. Same Rust code that linked green on 6-08 fails on a Go-only diff two days later, confirming toolchain drift rather than a code regression.This applies candidate fix (a) from the issue, the explicit extern import declaration, instead of pinning the toolchain:
#[link(wasm_import_module = "env")]to theextern "C"block so the symbol is emitted as a real WebAssembly import thatwasm-ldresolves as a host import.envmodule matches both host runtimes already in the tree: wazero'sNewHostModuleBuilder("env")on the Go side and theenvimport object on the Node side.core.wasmartifacts (go/ressrf/core.wasm,node/core.wasm).Test plan
rustc 1.96.0(import "env" "ressrf_host_audit_event" ...)and it surviveswasm-opt -Ozenvimport objectcargo fmt --all -- --check,cargo clippy -p ressrf-wasm --all-targets --all-features -- -D warnings, and aRUSTFLAGS=-DwarningsWASM build are all clean