Bug report — file picker crashes in the web client: HEAPU8 not exported
Found while: adding a new (unrelated) file-picker use case in a fork; not a regression we introduced —
this breaks every existing file-picker path in the web build (avatar model upload, animation upload),
they just don't appear to have been exercised end-to-end in the web client before.
Symptom
Any use of the browser file-picker widget (webclient/webclient.html's #file-picker-form) crashes the
WASM module on submit. Browser console:
Aborted('HEAPU8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ))
...
Uncaught (in promise) RuntimeError: unreachable
Root cause
webclient/webclient.html's form-submit handler writes the picked file's bytes directly into the wasm
heap before calling into C++:
const dataPtr = Module._malloc(uint8Array.length);
Module.HEAPU8.set(uint8Array, dataPtr); // <-- Module.HEAPU8 is undefined
Module.ccall('processFilePickerFile', ...);
gui_client/CMakeLists.txt's Emscripten link flags only export ccall:
-sEXPORTED_RUNTIME_METHODS=ccall
Newer Emscripten versions no longer expose HEAPU8/HEAP8/etc. on Module by default — they must be
listed explicitly in EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ entry the abort message points
at). This project's toolchain evidently predates that default, or was never actually run against this
code path, so the flag was never added.
Why it matters
This is the only file-picker mechanism the web client has (showFilePickerWidget() /
processFilePickerFile()), used for:
- avatar model upload (
UIInterface::PICK_AVATAR_MODEL)
- gesture/animation upload (
UIInterface::PICK_ANIMATION_FILE)
- (new, from our fork) Gaussian splat file upload (
UIInterface::PICK_GAUSSIAN_SPLAT)
Every one of these is broken in the web build today, unconditionally, on the very first attempt to
submit a file. Native/desktop (Qt) builds are unaffected — they don't go through this JS path.
Fix
One-line link-flag addition, gui_client/CMakeLists.txt:
- "-sEXPORTED_RUNTIME_METHODS=ccall"
+ "-sEXPORTED_RUNTIME_METHODS=ccall,HEAPU8"
Verified: rebuilding the web client with this flag and re-running the exact same file-picker flow
(browser file dialog → submit → processFilePickerFile()) succeeds with no console errors.
Repro steps (pre-fix)
- Build/run the web client (
gui_client.js/.wasm via Emscripten).
- Trigger any file picker (e.g. avatar settings → "load model", or the animation-add button in Gesture
Manager).
- Choose a file, click the form's submit button.
- Console shows the
HEAPU8 was not exported abort; the WASM module is now dead (unreachable trap),
requiring a page reload.
Bug report — file picker crashes in the web client:
HEAPU8not exportedFound while: adding a new (unrelated) file-picker use case in a fork; not a regression we introduced —
this breaks every existing file-picker path in the web build (avatar model upload, animation upload),
they just don't appear to have been exercised end-to-end in the web client before.
Symptom
Any use of the browser file-picker widget (
webclient/webclient.html's#file-picker-form) crashes theWASM module on submit. Browser console:
Root cause
webclient/webclient.html's form-submit handler writes the picked file's bytes directly into the wasmheap before calling into C++:
gui_client/CMakeLists.txt's Emscripten link flags only exportccall:Newer Emscripten versions no longer expose
HEAPU8/HEAP8/etc. onModuleby default — they must belisted explicitly in
EXPORTED_RUNTIME_METHODS(see the Emscripten FAQ entry the abort message pointsat). This project's toolchain evidently predates that default, or was never actually run against this
code path, so the flag was never added.
Why it matters
This is the only file-picker mechanism the web client has (
showFilePickerWidget()/processFilePickerFile()), used for:UIInterface::PICK_AVATAR_MODEL)UIInterface::PICK_ANIMATION_FILE)UIInterface::PICK_GAUSSIAN_SPLAT)Every one of these is broken in the web build today, unconditionally, on the very first attempt to
submit a file. Native/desktop (Qt) builds are unaffected — they don't go through this JS path.
Fix
One-line link-flag addition,
gui_client/CMakeLists.txt:Verified: rebuilding the web client with this flag and re-running the exact same file-picker flow
(browser file dialog → submit →
processFilePickerFile()) succeeds with no console errors.Repro steps (pre-fix)
gui_client.js/.wasmvia Emscripten).Manager).
HEAPU8 was not exportedabort; the WASM module is now dead (unreachable trap),requiring a page reload.