M0-11C
One-simulation spike part C: zoen-sim-ffi as wasm32-unknown-emscripten static lib in the Unity Web build; golden vectors pass in the browser
Evidence
From logs/evidence/M0-11C/. Click a thumbnail for the full image.
Logs and data (1)
plugin-web.json · 3 kB · open
{
"what": "zoen-sim C ABI static library for the Unity Web player (wasm32-unknown-emscripten, M0-11C)",
"finished": "2026-10-10T20:13:36.931Z",
"rustc": "rustc 1.99.0 (b940084d7 2026-09-28); LLVM version: 23.1.1",
"target": "wasm32-unknown-emscripten",
"emscripten": {
"path": "~/Unity/Hub/Editor/6000.3.25f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten",
"version": "3.1.39-git",
"clang": "clang version 17.0.0 (https://github-com-cache.bf.unity3d.com/Unity-Technologies/llvm-project 7c3f21cd3094c188678906d0459cda3b715e1963)",
"bundledWith": "Unity 6000.3.25f1"
},
"rustflags": "-C panic=abort",
"profile": "plugin (release, lto, codegen-units 1) as staticlib only",
"route": "stable rustc object files (LLVM 23) link with the bundled wasm-ld (LLVM 17); target_features names the bundled tools do not know are dropped (implied by the listed ones)",
"droppedFeatureNames": [
"bulk-memory-opt",
"call-indirect-overlong"
],
"features": [
"bulk-memory",
"exception-handling",
"multivalue",
"mutable-globals",
"nontrapping-fptoint",
"reference-types",
"sign-ext"
],
"members": 270,
"exports": [
"zoen_sim_abi_version",
"zoen_sim_create",
"zoen_sim_destroy",
"zoen_sim_push_inputs",
"zoen_sim_read_actors",
"zoen_sim_read_events",
"zoen_sim_spawn",
"zoen_sim_state",
"zoen_sim_step"
],
"cSmokeLinkFlags": [
…Tests
$ node tools/sim/build-plugin.mjs web$ node tools/sim/build-plugin.mjs web --no-install$ pnpm --filter @zoen/wiki exec playwright test --only-changedNotes
2026-10-10 20:14 UTC · Partial (context limit). Done: rustup target wasm32-unknown-emscripten; Unity 6000.3.25f1 bundles Emscripten 3.1.39-git with clang/LLVM 17 (Unity fork); rustc 1.99 is LLVM 23. tools/sim/build-plugin.mjs web: cargo rustc --crate-type staticlib (plugin profile, RUSTFLAGS -C panic=abort; the cdylib would need emcc as linker), unpack with the bundled llvm-ar, drop the LLVM 20+ target_features names bulk-memory-opt and call-indirect-overlong (implied by bulk-memory/reference-types which stay; the bundled emcc forwards every name to its wasm-opt, which failed with Unknown option --enable-bulk-memory-opt), repack (llvm-ar rcs), exports = header (9), C smoke linked by the bundled emcc with the player link flags (DISABLE_EXCEPTION_CATCHING=0, MIN_CHROME 57/FF 52/SAFARI 150000, WASM_BIGINT=0, -O2) and run in the bundled Node 20: ZOEN_SIM_C abi=1 hash=9212ab6e32ffa3ef pass (= macOS/Android). Archive 3,662,566 B, 270 members. Browser floor: precompiled std keeps legacy wasm-EH cleanup pads (try/catch_all/rethrow/delegate, never run under panic=abort) plus bulk-memory/reference-types: Chrome 95, Firefox 100, Safari 15.2; alternative to drop them later = -Zbuild-std + target-cpu=mvp (needs rust-src + nightly flags). Evidence logs/evidence/M0-11C/plugin-web.json. The .a is NOT installed in Assets (no import rules yet; an unconfigured .a could reach the Android link). Remains M0-11C2: (1) SimPluginImport.cs WebPlugin const Assets/Zoen/Plugins/WebGL/libzoen_sim_ffi.a + ApplyWeb (OnlyPlayer WebGL, editor off) in OnPreprocessAsset and Ensure; (2) Build.Run: for WebGL add extraScriptingDefines ZOEN_SIM_STATIC when that file exists; update the ZoenSimNative.cs header comment; (3) node tools/sim/build-plugin.mjs web (installs); (4) unity-run editmode, then build web in background; (5) web-smoke.mjs --sim like macos-smoke (tools/unity/sim-expect.mjs): finalHash bb46012ea5aaaebf, allMatch, step ns/tick for 1 and 5000 movers, 0 console errors; evidence web-smoke-sim.json, console .txt, screenshot, Web build size delta vs logs/test-output/unity/20261008-154205-build-web.json; (6) verify, CHANGELOG, then M0-11D.
