From 28483435f1e3792b1ac63112fd219423f7f9d5f9 Mon Sep 17 00:00:00 2001 From: Intubun <41478036+Intubun@users.noreply.github.com> Date: Tue, 7 Jul 2026 14:14:21 +0200 Subject: [PATCH] Fixed the WASM (emscripten) build, which broke starting with emscripten 6.0.2. The failure is not in magic itself but in the TCL dependency build: emscripten 6.0.2 began shipping a 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 , 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. --- toolchains/emscripten/build-tcl-wasm.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/toolchains/emscripten/build-tcl-wasm.sh b/toolchains/emscripten/build-tcl-wasm.sh index 1de9b864..b93617df 100644 --- a/toolchains/emscripten/build-tcl-wasm.sh +++ b/toolchains/emscripten/build-tcl-wasm.sh @@ -93,6 +93,18 @@ cd "$OUT" # --disable-shared we statically link libtcl into magic.wasm. # --disable-load no dynamic loading inside wasm. # --enable-symbols=no release (-O2). Override CFLAGS to add -g for debug. +# +# ac_cv_header_sys_epoll_h=no forces TCL onto its select()-based notifier. +# On a Linux host, TCL's configure runs `AC_CHECK_HEADERS([sys/epoll.h])` and, +# if found, defines NOTIFIER_EPOLL and compiles tclEpollNotfy.c. Emscripten +# 6.0.2 started shipping a stub in its sysroot (6.0.1 did not), +# so that probe now passes — but tclEpollNotfy.c also needs , +# which emscripten does NOT provide, so the build dies with +# tclEpollNotfy.c: fatal error: 'sys/queue.h' file not found +# The select() notifier is the correct choice for single-threaded WASM anyway +# (emscripten's epoll is a stub), so we pin it here rather than track the +# emscripten sysroot. Overriding the autoconf cache var is cleaner than +# patching the read-only TCL source tree. if [ ! -f Makefile ]; then echo "=== emconfigure ===" CFLAGS="-O2 -sUSE_ZLIB=1" \ @@ -101,7 +113,8 @@ if [ ! -f Makefile ]; then --disable-load \ --enable-symbols=no \ --host=wasm32-unknown-emscripten \ - --prefix="$OUT/install" + --prefix="$OUT/install" \ + ac_cv_header_sys_epoll_h=no fi # emconfigure writes tclConfig.sh into the build dir. If it is missing, the