From f90c2370ccd682562475c651031337b6a9d3a90c Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Thu, 3 Oct 2024 12:23:33 +0200 Subject: [PATCH 1/3] Emscripten: Clean up flags for old node versions These flags are only needed for node <= 16. Node 16 has been end of life since October of 2023. --- configure | 55 ---------------------------------------------------- configure.ac | 28 -------------------------- 2 files changed, 83 deletions(-) diff --git a/configure b/configure index 0cc73e4e66552d..5d0db07ac94a34 100755 --- a/configure +++ b/configure @@ -7755,61 +7755,6 @@ else fi HOSTRUNNER="$NODE" - # bigint for ctypes c_longlong, c_longdouble - # no longer available in Node 16 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for node --experimental-wasm-bigint" >&5 -printf %s "checking for node --experimental-wasm-bigint... " >&6; } -if test ${ac_cv_tool_node_wasm_bigint+y} -then : - printf %s "(cached) " >&6 -else $as_nop - - if $NODE -v --experimental-wasm-bigint > /dev/null 2>&1; then - ac_cv_tool_node_wasm_bigint=yes - else - ac_cv_tool_node_wasm_bigint=no - fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_tool_node_wasm_bigint" >&5 -printf "%s\n" "$ac_cv_tool_node_wasm_bigint" >&6; } - if test "x$ac_cv_tool_node_wasm_bigint" = xyes -then : - - as_fn_append HOSTRUNNER " --experimental-wasm-bigint" - -fi - - if test "x$enable_wasm_pthreads" = xyes -then : - - as_fn_append HOSTRUNNER " --experimental-wasm-threads" - # no longer available in Node 16 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for node --experimental-wasm-bulk-memory" >&5 -printf %s "checking for node --experimental-wasm-bulk-memory... " >&6; } -if test ${ac_cv_tool_node_wasm_bulk_memory+y} -then : - printf %s "(cached) " >&6 -else $as_nop - - if $NODE -v --experimental-wasm-bulk-memory > /dev/null 2>&1; then - ac_cv_tool_node_wasm_bulk_memory=yes - else - ac_cv_tool_node_wasm_bulk_memory=no - fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_tool_node_wasm_bulk_memory" >&5 -printf "%s\n" "$ac_cv_tool_node_wasm_bulk_memory" >&6; } - if test "x$ac_cv_tool_node_wasm_bulk_memory" = xyes -then : - - as_fn_append HOSTRUNNER " --experimental-wasm-bulk-memory" - -fi - -fi - if test "x$host_cpu" = xwasm64 then : as_fn_append HOSTRUNNER " --experimental-wasm-memory64" diff --git a/configure.ac b/configure.ac index 1864e94ace9243..f67f8a5a0d32e5 100644 --- a/configure.ac +++ b/configure.ac @@ -1619,34 +1619,6 @@ then [Emscripten/node*], [ AC_PATH_TOOL([NODE], [node], [node]) HOSTRUNNER="$NODE" - # bigint for ctypes c_longlong, c_longdouble - # no longer available in Node 16 - AC_CACHE_CHECK([for node --experimental-wasm-bigint], [ac_cv_tool_node_wasm_bigint], [ - if $NODE -v --experimental-wasm-bigint > /dev/null 2>&1; then - ac_cv_tool_node_wasm_bigint=yes - else - ac_cv_tool_node_wasm_bigint=no - fi - ]) - AS_VAR_IF([ac_cv_tool_node_wasm_bigint], [yes], [ - AS_VAR_APPEND([HOSTRUNNER], [" --experimental-wasm-bigint"]) - ]) - - AS_VAR_IF([enable_wasm_pthreads], [yes], [ - AS_VAR_APPEND([HOSTRUNNER], [" --experimental-wasm-threads"]) - # no longer available in Node 16 - AC_CACHE_CHECK([for node --experimental-wasm-bulk-memory], [ac_cv_tool_node_wasm_bulk_memory], [ - if $NODE -v --experimental-wasm-bulk-memory > /dev/null 2>&1; then - ac_cv_tool_node_wasm_bulk_memory=yes - else - ac_cv_tool_node_wasm_bulk_memory=no - fi - ]) - AS_VAR_IF([ac_cv_tool_node_wasm_bulk_memory], [yes], [ - AS_VAR_APPEND([HOSTRUNNER], [" --experimental-wasm-bulk-memory"]) - ]) - ]) - AS_VAR_IF([host_cpu], [wasm64], [AS_VAR_APPEND([HOSTRUNNER], [" --experimental-wasm-memory64"])]) ], dnl TODO: support other WASI runtimes From ad3c4850b100abda11b549bb1bb4022186d032a1 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Thu, 3 Oct 2024 15:16:10 +0200 Subject: [PATCH 2/3] Add version check for node < 18 --- Tools/wasm/emscripten/node_pre.js | 9 +++++++++ configure | 1 + configure.ac | 1 + 3 files changed, 11 insertions(+) create mode 100644 Tools/wasm/emscripten/node_pre.js diff --git a/Tools/wasm/emscripten/node_pre.js b/Tools/wasm/emscripten/node_pre.js new file mode 100644 index 00000000000000..3490d3ca591ef6 --- /dev/null +++ b/Tools/wasm/emscripten/node_pre.js @@ -0,0 +1,9 @@ +// If process is undefined, we're not running in the node runtime let it go I +// guess? +if (typeof process !== "undefined") { + const nodeVersion = Number(process.versions.node.split('.',1)[0]); + if (nodeVersion < 18) { + process.stderr.write(`Node version must be >= 18, got version ${process.version}\n`); + process.exit(1); + } +} diff --git a/configure b/configure index 5d0db07ac94a34..ef048204d4fb1f 100755 --- a/configure +++ b/configure @@ -9520,6 +9520,7 @@ fi then : wasm_debug=yes fi + as_fn_append LDFLAGS_NODIST " --pre-js=\$(srcdir)/Tools/wasm/emscripten/node_pre.js" as_fn_append LDFLAGS_NODIST " -sALLOW_MEMORY_GROWTH -sNODERAWFS" as_fn_append LINKFORSHARED " -sEXIT_RUNTIME" WASM_LINKFORSHARED_DEBUG="-gseparate-dwarf --emit-symbol-map" diff --git a/configure.ac b/configure.ac index f67f8a5a0d32e5..8ab51438a173e5 100644 --- a/configure.ac +++ b/configure.ac @@ -2393,6 +2393,7 @@ AS_CASE([$ac_sys_system], ], [node*], [ AS_VAR_IF([ac_sys_emscripten_target], [node-debug], [wasm_debug=yes]) + AS_VAR_APPEND([LDFLAGS_NODIST], [" --pre-js=\$(srcdir)/Tools/wasm/emscripten/node_pre.js"]) AS_VAR_APPEND([LDFLAGS_NODIST], [" -sALLOW_MEMORY_GROWTH -sNODERAWFS"]) AS_VAR_APPEND([LINKFORSHARED], [" -sEXIT_RUNTIME"]) WASM_LINKFORSHARED_DEBUG="-gseparate-dwarf --emit-symbol-map" From 96e9e40b63e5ecfac611390cbdcaf43344bf65c8 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Fri, 4 Oct 2024 17:22:41 +0200 Subject: [PATCH 3/3] Add blurb --- .../next/Build/2024-10-04-17-29-23.gh-issue-124928.FsGffe.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Build/2024-10-04-17-29-23.gh-issue-124928.FsGffe.rst diff --git a/Misc/NEWS.d/next/Build/2024-10-04-17-29-23.gh-issue-124928.FsGffe.rst b/Misc/NEWS.d/next/Build/2024-10-04-17-29-23.gh-issue-124928.FsGffe.rst new file mode 100644 index 00000000000000..291bf336ef225e --- /dev/null +++ b/Misc/NEWS.d/next/Build/2024-10-04-17-29-23.gh-issue-124928.FsGffe.rst @@ -0,0 +1 @@ +Emscripten builds now require node >= 18.