-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Problem
The WASM build (zig build wasm) fails with:
wasm-ld: undefined symbol: main
This happens because:
- The primitives dependency includes C libraries (BLST, C-KZG, BN254)
- These require linking with libc (
-lc) - WASI libc expects a
mainfunction entry point - Even with
entry = .disabledand-fno-entry, the linker still requiresmain
Current Workaround
Removed WASM from the default zig build step (commit 2d2119a). The WASM build is now only triggered explicitly via zig build wasm, but it still fails.
Potential Solutions
- Add a stub main function - Export a no-op
maininsrc/root_c.zigwhen targeting WASI - Use freestanding target - Switch from
wasm32-wasitowasm32-freestanding, but this may break C library compatibility - Conditional C library linking - Only link crypto libraries when not targeting WASM (would reduce WASM functionality)
- Custom WASI reactor entry - Use
_initializeinstead ofmainfor WASI reactor-style modules
References
- WASI Application ABI - Reactors vs Commands
- Zig WASI support
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels