Bugfix for WASM Build with emscripten >6.0.2#536
Open
Intubun wants to merge 2 commits into
Open
Conversation
…en 6.0.2. The failure is not in magic itself but in the TCL dependency build: emscripten 6.0.2 began shipping a <sys/epoll.h> stub in its sysroot (6.0.1 did not), so TCL's configure now detects epoll on the Linux CI host via AC_CHECK_HEADERS([sys/epoll.h]), defines NOTIFIER_EPOLL, and compiles tclEpollNotfy.c. That file also requires <sys/queue.h>, which emscripten does not provide, so the build died with "fatal error: 'sys/queue.h' file not found". Fixed by passing ac_cv_header_sys_epoll_h=no to TCL's configure in toolchains/emscripten/build-tcl-wasm.sh, which forces the select()-based notifier. That notifier is the correct choice for single-threaded WASM anyway (emscripten's epoll is only a stub), and overriding the autoconf cache variable avoids patching the read-only TCL source tree and keeps the build working across future emscripten versions.
…e at runtime rather than at compile time. emscripten 6.0.2 removed wasmBinary (along with a batch of GL/SDL members) from the default INCOMING_MODULE_JS_API list. The JS loaders in npm/examples pass Module.wasmBinary to embed the .wasm binary, and because the WASM build links with -sASSERTIONS=1, the now-unrecognized member triggers a hard runtime abort: "`Module.wasmBinary` was supplied but `wasmBinary` not included in INCOMING_MODULE_JS_API", failing every example test. Fixed by explicitly setting -sINCOMING_MODULE_JS_API in toolchains/emscripten/defs.mak to emscripten's full default list plus wasmBinary. Spelling out the whole default (rather than only the members our own loaders use) keeps external consumers of the npm package working if they supply locateFile, arguments, and similar Module options.
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.
This PR is related to Issue #533 . Here a small summary:
<sys/epoll.h> stub, and it dropped wasmBinary from the default INCOMING_MODULE_JS_API list. Both broke the
WASM build in different ways.
invocation, forcing the select()-based notifier. The new <sys/epoll.h> stub made TCL pick the epoll
notifier (tclEpollNotfy.c), which needs <sys/queue.h> — a header emscripten doesn't provide — causing a
compile-time fatal error: 'sys/queue.h' file not found.
wasmBinary). Because wasmBinary was removed from the default, the loaders passing Module.wasmBinary
triggered a hard runtime abort under -sASSERTIONS=1 (Module.wasmBinary … not included in
INCOMING_MODULE_JS_API), failing every example test.