diff --git a/Makefile.envs b/Makefile.envs index 426e710b8..84c10f772 100644 --- a/Makefile.envs +++ b/Makefile.envs @@ -1,5 +1,5 @@ export PYVERSION ?= 3.11.3 -export PYODIDE_EMSCRIPTEN_VERSION ?= 3.1.46 +export PYODIDE_EMSCRIPTEN_VERSION ?= 3.1.52 ifdef CPYTHON_DEBUG export CPYTHON_ABI_FLAGS=d diff --git a/cpython/patches/0009-Fix-LONG_BIT-constant-to-be-always-32bit.patch b/cpython/patches/0009-Fix-LONG_BIT-constant-to-be-always-32bit.patch new file mode 100644 index 000000000..bb953c9ce --- /dev/null +++ b/cpython/patches/0009-Fix-LONG_BIT-constant-to-be-always-32bit.patch @@ -0,0 +1,33 @@ +From 929b4f9c1f8867d22cc0d0abcafa9c96c5a28093 Mon Sep 17 00:00:00 2001 +From: ryanking13 +Date: Fri, 12 Jan 2024 00:52:57 +0900 +Subject: [PATCH 9/9] Fix LONG_BIT constant to be always 32bit + +Starting from Emscripten 3.1.50, there is an issue where LONG_BIT is +calculated to 64 for some reason. This is very strange because LONG_MAX +becomes 2^64-1 when calculating LONG_BIT (in limits.h), but it then +becomes 2^32-1 when it is accessed in other places. + +I wasn't able to make a minimal code to reproduce a bug. Probably +something is messed up while importing pyconfig.h, etc. + +Related: https://github.com/emscripten-core/emscripten/pull/20752 +--- + Include/pyport.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Include/pyport.h b/Include/pyport.h +index 93250f4eb1..cfaa267139 100644 +--- a/Include/pyport.h ++++ b/Include/pyport.h +@@ -588,6 +588,7 @@ extern char * _getpty(int *, int, mode_t, int); + #define LONG_MIN (-LONG_MAX-1) + #endif + ++#undef LONG_BIT + #ifndef LONG_BIT + #define LONG_BIT (8 * SIZEOF_LONG) + #endif +-- +2.29.2.windows.2 + diff --git a/cpython/pyconfig.undefs.h b/cpython/pyconfig.undefs.h deleted file mode 100644 index b10daa46c..000000000 --- a/cpython/pyconfig.undefs.h +++ /dev/null @@ -1,38 +0,0 @@ -#undef HAVE_EPOLL -#undef HAVE_EPOLL_CREATE1 -#undef HAVE_LINUX_VM_SOCKETS_H -#undef HAVE_SOCKETPAIR -#undef HAVE_UTIMENSAT -#undef HAVE_SIGACTION - -/* Untested syscalls in emscripten */ -#undef HAVE_OPENAT -#undef HAVE_MKDIRAT -#undef HAVE_FCHOWNAT -#undef HAVE_RENAMEAT -#undef HAVE_LINKAT -#undef HAVE_SYMLINKAT -#undef HAVE_READLINKAT -#undef HAVE_FCHMODAT -#undef HAVE_DUP3 - -/* Syscalls not implemented in emscripten */ -#undef HAVE_PREADV -#undef HAVE_PWRITEV -#undef HAVE_PIPE2 -#undef HAVE_NICE -#undef HAVE_EVENTFD - -/* Syscalls that resulted in a segfault */ -#undef HAVE_UTIMENSAT -#undef HAVE_SYS_SOCKET_H -#undef HAVE_SYS_IOCTL_H - -/* Unsupported functionality */ -#undef HAVE_PTHREAD_H -#undef HAVE_MEMFD_CREATE - -#define CONFIG_32 -#define ANSI - -#undef HAVE_MEMFD_CREATE diff --git a/docs/project/changelog.md b/docs/project/changelog.md index f5eaa87d8..1d353d1a4 100644 --- a/docs/project/changelog.md +++ b/docs/project/changelog.md @@ -16,6 +16,9 @@ myst: ## Unreleased +- {{ Enhancement }} ABI Break: Updated Emscripten to version 3.1.52 + {pr}`4399` + - {{ Enhancement }} Added apis to discard extra arguments when calling Python functions. {pr}`4392` diff --git a/emsdk/Makefile b/emsdk/Makefile index add350e0b..660bf6ecd 100644 --- a/emsdk/Makefile +++ b/emsdk/Makefile @@ -23,7 +23,7 @@ emsdk/.complete: ../Makefile.envs $(wildcard patches/*.patch) update_struct_info: - rm ../src/js/generated_struct_info32.json + rm -f ../src/js/generated_struct_info32.json cd ../src/js && wget "https://raw.githubusercontent.com/emscripten-core/emscripten/$(PYODIDE_EMSCRIPTEN_VERSION)/src/generated_struct_info32.json" diff --git a/emsdk/patches/0001-Add-useful-error-when-symbol-resolution-fails.patch b/emsdk/patches/0001-Add-useful-error-when-symbol-resolution-fails.patch index ec50727a1..1a98c10cd 100644 --- a/emsdk/patches/0001-Add-useful-error-when-symbol-resolution-fails.patch +++ b/emsdk/patches/0001-Add-useful-error-when-symbol-resolution-fails.patch @@ -19,13 +19,13 @@ symbol. 1 file changed, 3 insertions(+) diff --git a/src/library_dylink.js b/src/library_dylink.js -index d96e6b425..7f63b5c5e 100644 +index 7685f113c..4cfe137b2 100644 --- a/src/library_dylink.js +++ b/src/library_dylink.js -@@ -727,6 +727,9 @@ var LibraryDylink = { +@@ -709,6 +709,9 @@ var LibraryDylink = { var resolved; stubs[prop] = function() { - if (!resolved) resolved = resolveSymbol(prop); + resolved ||= resolveSymbol(prop); + if (!resolved) { + throw new Error(`Dynamic linking error: cannot resolve symbol ${prop}`); + } diff --git a/emsdk/patches/0001-Changes-for-JSPI.patch b/emsdk/patches/0001-Changes-for-JSPI.patch index e8addc577..cd3a90561 100644 --- a/emsdk/patches/0001-Changes-for-JSPI.patch +++ b/emsdk/patches/0001-Changes-for-JSPI.patch @@ -30,7 +30,7 @@ index 736f73c66..fd769f7cc 100644 @@ -73,6 +73,7 @@ var LibraryDylink = { #if !DISABLE_EXCEPTION_CATCHING || SUPPORT_LONGJMP == 'emscripten' $createInvokeFunction__internal: true, - $createInvokeFunction__deps: ['$dynCall', 'setThrew'], + $createInvokeFunction__deps: ['$dynCall', 'setThrew', 'stackSave', 'stackRestore'], + $createInvokeFunction__postset: "if(!Module.createInvoke) { Module.createInvoke = Module.createInvokeFunction; }", $createInvokeFunction: (sig) => { return function() { @@ -58,7 +58,7 @@ index a069d0e21..0f99ab28a 100644 function storeException(varName, excPtr) { diff --git a/src/preamble.js b/src/preamble.js -index d4041cd26..6f44924cf 100644 +index 46efc1df1..7eb509bb7 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -14,6 +14,10 @@ @@ -69,19 +69,18 @@ index d4041cd26..6f44924cf 100644 + Module.wrapException = (e) => e; +} + - #if BENCHMARK - Module.realPrint = out; - out = err = () => {}; -@@ -928,6 +932,9 @@ function instantiateAsync(binary, binaryFile, imports, callback) { - // Create the wasm instance. + #if RELOCATABLE + {{{ makeModuleReceiveWithVar('dynamicLibraries', undefined, '[]', true) }}} + #endif +@@ -926,6 +930,9 @@ function instantiateAsync(binary, binaryFile, imports, callback) { // Receives the wasm imports, returns the exports. function createWasm() { + // prepare imports + if (Module.adjustWasmImports) { + Module.adjustWasmImports(wasmImports); + } - // prepare imports var info = { #if MINIFY_WASM_IMPORTED_MODULES + 'a': wasmImports, -- 2.25.1 - diff --git a/emsdk/patches/0001-FIX-Turn-off-settings.LTO-if-fno-lto-is-passed.patch b/emsdk/patches/0001-FIX-Turn-off-settings.LTO-if-fno-lto-is-passed.patch deleted file mode 100644 index ad3d4c14a..000000000 --- a/emsdk/patches/0001-FIX-Turn-off-settings.LTO-if-fno-lto-is-passed.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 104216ca846c9aa0903f96a28353cd1b02b7a6a3 Mon Sep 17 00:00:00 2001 -From: Hood Chatham -Date: Thu, 21 Sep 2023 15:07:24 -0700 -Subject: [PATCH] FIX Turn off `settings.LTO` if `-fno-lto` is passed - -Backport of https://github.com/emscripten-core/emscripten/pull/20309 - ---- - emcc.py | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/emcc.py b/emcc.py -index 84787021b..f06b27017 100644 ---- a/emcc.py -+++ b/emcc.py -@@ -3454,6 +3454,8 @@ def parse_args(newargs): - settings.LTO = arg.split('=')[1] - else: - settings.LTO = 'full' -+ elif arg == "-fno-lto": -+ settings.LTO = 0 - elif check_arg('--llvm-lto'): - logger.warning('--llvm-lto ignored when using llvm backend') - consume_arg() --- -2.25.1 - diff --git a/emsdk/patches/0001-Fix-acorn-optimizer-invalid-optimizations.patch b/emsdk/patches/0001-Fix-acorn-optimizer-invalid-optimizations.patch deleted file mode 100644 index 8d29103b3..000000000 --- a/emsdk/patches/0001-Fix-acorn-optimizer-invalid-optimizations.patch +++ /dev/null @@ -1,261 +0,0 @@ -From b07076f83eb1d3e8248ceb67e4d3387653e434b3 Mon Sep 17 00:00:00 2001 -From: Hood Chatham -Date: Tue, 16 Jan 2024 16:34:59 -0800 -Subject: [PATCH] Fix acorn optimizer invalid optimizations - ---- - ...acorn-optimizer.js => acorn-optimizer.mjs} | 101 +++++++++++++----- - tools/building.py | 2 +- - tools/js_optimizer.py | 2 +- - 3 files changed, 78 insertions(+), 27 deletions(-) - rename tools/{acorn-optimizer.js => acorn-optimizer.mjs} (95%) - -diff --git a/tools/acorn-optimizer.js b/tools/acorn-optimizer.mjs -similarity index 95% -rename from tools/acorn-optimizer.js -rename to tools/acorn-optimizer.mjs -index 5274f3114..c62e29f06 100755 ---- a/tools/acorn-optimizer.js -+++ b/tools/acorn-optimizer.mjs -@@ -1,10 +1,8 @@ - #!/usr/bin/env node - --'use strict'; -- --const acorn = require('acorn'); --const terser = require('../third_party/terser/terser'); --const fs = require('fs'); -+import * as acorn from 'acorn'; -+import * as terser from '../third_party/terser/terser.js'; -+import * as fs from 'fs'; - - // Utilities - -@@ -26,6 +24,15 @@ function assert(condition, text) { - } - } - -+function assertAt(condition, node, message = '') { -+ if (!condition) { -+ const loc = acorn.getLineInfo(input, node.start); -+ throw new Error( -+ `${infile}:${loc.line}: ${message} (use EMCC_DEBUG_SAVE=1 to preserve temporary inputs)`, -+ ); -+ } -+} -+ - function warnOnce(msg) { - if (!warnOnce.msgs) warnOnce.msgs = {}; - if (msg in warnOnce.msgs) return; -@@ -190,7 +197,7 @@ function restoreForVars(node) { - let restored = 0; - function fix(init) { - if (init && init.type === 'EmptyStatement') { -- assert(init.oldDeclarations); -+ assertAt(init.oldDeclarations, init); - init.type = 'VariableDeclaration'; - init.declarations = init.oldDeclarations; - restored++; -@@ -319,7 +326,16 @@ function runJSDCE(ast, aggressive) { - const old = node.declarations; - let removedHere = 0; - node.declarations = node.declarations.filter((node) => { -- const curr = node.id.name; -+ assert(node.type === 'VariableDeclarator'); -+ const id = node.id; -+ if (id.type === 'ObjectPattern' || id.type === 'ArrayPattern') { -+ // TODO: DCE into object patterns, that is, things like -+ // let { a, b } = .. -+ // let [ a, b ] = .. -+ return true; -+ } -+ assert(id.type === 'Identifier'); -+ const curr = id.name; - const value = node.init; - const keep = !(curr in names) || (value && hasSideEffects(value)); - if (!keep) removedHere = 1; -@@ -361,12 +377,30 @@ function runJSDCE(ast, aggressive) { - ensureData(scopes[scopes.length - 1], node.id.name).def = 1; - } - const scope = {}; -- node.params.forEach((param) => { -- const name = param.name; -- ensureData(scope, name).def = 1; -- scope[name].param = 1; -- }); - scopes.push(scope); -+ node.params.forEach(function traverse(param) { -+ if (param.type === 'RestElement') { -+ param = param.argument; -+ } -+ if (param.type === 'AssignmentPattern') { -+ c(param.right); -+ param = param.left; -+ } -+ if (param.type === 'ArrayPattern') { -+ for (var elem of param.elements) { -+ traverse(elem); -+ } -+ } else if (param.type === 'ObjectPattern') { -+ for (var prop of param.properties) { -+ traverse(prop.key); -+ } -+ } else { -+ assert(param.type === 'Identifier', param.type); -+ const name = param.name; -+ ensureData(scope, name).def = 1; -+ scope[name].param = 1; -+ } -+ }); - c(node.body); - // we can ignore self-references, i.e., references to ourselves inside - // ourselves, for named defined (defun) functions -@@ -390,8 +424,22 @@ function runJSDCE(ast, aggressive) { - - recursiveWalk(ast, { - VariableDeclarator(node, c) { -- const name = node.id.name; -- ensureData(scopes[scopes.length - 1], name).def = 1; -+ function traverse(id) { -+ if (id.type === 'ObjectPattern') { -+ for (const prop of id.properties) { -+ traverse(prop.value); -+ } -+ } else if (id.type === 'ArrayPattern') { -+ for (const elem of id.elements) { -+ if (elem) traverse(elem); -+ } -+ } else { -+ assertAt(id.type === 'Identifier', id, `expected Indentifier but found ${id.type}`); -+ const name = id.name; -+ ensureData(scopes[scopes.length - 1], name).def = 1; -+ } -+ } -+ traverse(node.id); - if (node.init) c(node.init); - }, - ObjectExpression(node, c) { -@@ -682,7 +730,7 @@ function emitDCEGraph(ast) { - // use the left hand identifier. - value = value.left; - } -- assert(value.type === 'Identifier'); -+ assertAt(value.type === 'Identifier', value); - imports.push(value.name); // the name doesn't matter, only the value which is that actual thing we are importing - }); - foundWasmImportsAssign = true; -@@ -742,7 +790,7 @@ function emitDCEGraph(ast) { - // var x = Module['x'] = 1234; - // this form occurs when global addresses are exported from the - // module. It doesn't constitute a usage. -- assert(typeof value.right.value === 'number'); -+ assertAt(typeof value.right.value === 'number', value.right); - emptyOut(node); - } - } -@@ -829,7 +877,7 @@ function emitDCEGraph(ast) { - // must find the info we need - assert( - foundWasmImportsAssign, -- 'could not find the assigment to "wasmImports". perhaps --pre-js or --post-js code moved it out of the global scope? (things like that should be done after emcc runs, as they do not need to be run through the optimizer which is the special thing about --pre-js/--post-js code)' -+ 'could not find the assigment to "wasmImports". perhaps --pre-js or --post-js code moved it out of the global scope? (things like that should be done after emcc runs, as they do not need to be run through the optimizer which is the special thing about --pre-js/--post-js code)', - ); - // Read exports that were declared in extraInfo - if (extraInfo) { -@@ -943,7 +991,10 @@ function emitDCEGraph(ast) { - print(JSON.stringify(graph, null, ' ')); - } - --// Apply graph removals from running wasm-metadce -+// Apply graph removals from running wasm-metadce. This only removes imports and -+// exports from JS side, effectively disentangling the wasm and JS sides that -+// way (and we leave further DCE on the JS and wasm sides to their respective -+// optimizers, closure compiler and binaryen). - function applyDCEGraphRemovals(ast) { - const unused = new Set(extraInfo.unused); - -@@ -1010,7 +1061,7 @@ function applyDCEGraphRemovals(ast) { - - // Need a parser to pass to acorn.Node constructor. - // Create it once and reuse it. --const stubParser = new acorn.Parser({ecmaVersion: 2020}); -+const stubParser = new acorn.Parser({ecmaVersion: 2021}); - - function createNode(props) { - const node = new acorn.Node(stubParser); -@@ -1676,7 +1727,7 @@ function minifyLocals(ast) { - // locals are just numbers, not functions; functions are all declared - // in the outer scope. If a local is called, that is a bug. - if (node.callee.type === 'Identifier') { -- assert(!isLocalName(node.callee.name), 'cannot call a local'); -+ assertAt(!isLocalName(node.callee.name), node.callee, 'cannot call a local'); - } - }, - }); -@@ -1785,7 +1836,7 @@ function minifyGlobals(ast) { - ast.type === 'Program' && - ast.body.length === 1 && - ast.body[0].type === 'FunctionDeclaration' && -- ast.body[0].id.name === 'instantiate' -+ ast.body[0].id.name === 'instantiate', - ); - const fun = ast.body[0]; - -@@ -1890,7 +1941,7 @@ function reattachComments(ast, comments) { - if (node.start && node.start.pos) { - symbols.push(node); - } -- }) -+ }), - ); - - // Sort them by ascending line number -@@ -1922,8 +1973,8 @@ function reattachComments(ast, comments) { - false, - undefined, - undefined, -- '0' -- ) -+ '0', -+ ), - ); - } - } -@@ -1974,7 +2025,7 @@ let ast; - try { - ast = acorn.parse(input, { - // Keep in sync with --language_in that we pass to closure in building.py -- ecmaVersion: 2020, -+ ecmaVersion: 2021, - preserveParens: closureFriendly, - onComment: closureFriendly ? sourceComments : undefined, - sourceType: exportES6 ? 'module' : 'script', -diff --git a/tools/building.py b/tools/building.py -index 23ea25182..10747ef00 100644 ---- a/tools/building.py -+++ b/tools/building.py -@@ -327,7 +327,7 @@ def js_optimizer(filename, passes): - - # run JS optimizer on some JS, ignoring asm.js contents if any - just run on it all - def acorn_optimizer(filename, passes, extra_info=None, return_output=False): -- optimizer = path_from_root('tools/acorn-optimizer.js') -+ optimizer = path_from_root('tools/acorn-optimizer.mjs') - original_filename = filename - if extra_info is not None: - temp_files = shared.get_temp_files() -diff --git a/tools/js_optimizer.py b/tools/js_optimizer.py -index d5dd1ed85..158fed6ca 100755 ---- a/tools/js_optimizer.py -+++ b/tools/js_optimizer.py -@@ -22,7 +22,7 @@ from tools import building, config, shared, utils - temp_files = shared.get_temp_files() - - --ACORN_OPTIMIZER = path_from_root('tools/acorn-optimizer.js') -+ACORN_OPTIMIZER = path_from_root('tools/acorn-optimizer.mjs') - - NUM_CHUNKS_PER_CORE = 3 - MIN_CHUNK_SIZE = int(os.environ.get('EMCC_JSOPT_MIN_CHUNK_SIZE') or 512 * 1024) # configuring this is just for debugging purposes --- -2.25.1 - diff --git a/emsdk/patches/0001-Raise-when-no-argument-is-given.patch b/emsdk/patches/0001-Raise-when-no-argument-is-given.patch new file mode 100644 index 000000000..2e29b856c --- /dev/null +++ b/emsdk/patches/0001-Raise-when-no-argument-is-given.patch @@ -0,0 +1,32 @@ +From 6ccac524c72287abf2a55d6831a7b80207526d93 Mon Sep 17 00:00:00 2001 +From: ryanking13 +Date: Sat, 20 Jan 2024 19:02:32 +0900 +Subject: [PATCH 1/1] Raise when no argument is given + +Emscripten 3.1.51 does not raise an error when no argument is given. +Some build tools (e.g. ffmpeg) relies on this behavior, so we should +keep it. + +Upstream issue: https://github.com/emscripten-core/emscripten/issues/21116 + +--- + emcc.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/emcc.py b/emcc.py +index 887002734..7770e3df2 100644 +--- a/emcc.py ++++ b/emcc.py +@@ -617,6 +617,9 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P + print(libname) + return 0 + ++ if not input_files and not state.link_flags: ++ exit_with_error('no input files') ++ + if options.reproduce: + create_reproduce_file(options.reproduce, args) + +-- +2.29.2.windows.2 + diff --git a/emsdk/patches/0001-Support-externref-in-EM_JS-functions-with-dynamic-li.patch b/emsdk/patches/0001-Support-externref-in-EM_JS-functions-with-dynamic-li.patch deleted file mode 100644 index eabc473bf..000000000 --- a/emsdk/patches/0001-Support-externref-in-EM_JS-functions-with-dynamic-li.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 04dd736fe3ea0d469b84800585eaa4ca6648b9f9 Mon Sep 17 00:00:00 2001 -From: Hood Chatham -Date: Thu, 31 Aug 2023 13:53:39 +0200 -Subject: [PATCH] Support externref in EM_JS functions with dynamic linking - ---- - emscripten.py | 1 + - src/library_addfunction.js | 1 + - test/core/test_externref2.c | 22 ++++++++++++++++++++++ - test/core/test_externref2.out | 2 ++ - test/test_core.py | 14 ++++++++++++++ - 5 files changed, 40 insertions(+) - create mode 100644 test/core/test_externref2.c - create mode 100644 test/core/test_externref2.out - -diff --git a/emscripten.py b/emscripten.py -index f011a58b8..74ea6f525 100644 ---- a/emscripten.py -+++ b/emscripten.py -@@ -601,6 +601,7 @@ def type_to_sig(type): - webassembly.Type.I64: 'j', - webassembly.Type.F32: 'f', - webassembly.Type.F64: 'd', -+ webassembly.Type.EXTERNREF: 'e', - webassembly.Type.VOID: 'v' - }[type] - -diff --git a/src/library_addfunction.js b/src/library_addfunction.js -index 39e00b772..1537dca66 100644 ---- a/src/library_addfunction.js -+++ b/src/library_addfunction.js -@@ -29,6 +29,7 @@ addToLibrary({ - 'j': 'i64', - 'f': 'f32', - 'd': 'f64', -+ 'e': 'externref', - #if MEMORY64 - 'p': 'i64', - #else -diff --git a/test/core/test_externref2.c b/test/core/test_externref2.c -new file mode 100644 -index 000000000..47451c260 ---- /dev/null -+++ b/test/core/test_externref2.c -@@ -0,0 +1,22 @@ -+#include "emscripten.h" -+ -+ -+EM_JS(__externref_t, get_ref, (), { -+ return {a: 7, b: 9}; -+}); -+ -+EM_JS(void, modify_ref, (__externref_t arg), { -+ arg.a += 3; -+ arg.b -= 3; -+}); -+ -+EM_JS(void, log_ref, (__externref_t arg), { -+ console.log(arg); -+}); -+ -+int main() { -+ __externref_t a = get_ref(); -+ log_ref(a); -+ modify_ref(a); -+ log_ref(a); -+} -diff --git a/test/core/test_externref2.out b/test/core/test_externref2.out -new file mode 100644 -index 000000000..eaceb4e73 ---- /dev/null -+++ b/test/core/test_externref2.out -@@ -0,0 +1,2 @@ -+{ a: 7, b: 9 } -+{ a: 10, b: 6 } -diff --git a/test/test_core.py b/test/test_core.py -index 2f776068d..8b1933bf9 100644 ---- a/test/test_core.py -+++ b/test/test_core.py -@@ -9699,6 +9699,20 @@ NODEFS is no longer included by default; build with -lnodefs.js - self.emcc_args += ['-mreference-types'] - self.do_core_test('test_externref.c', libraries=['asm.o']) - -+ @parameterized({ -+ '': [False], -+ 'dynlink': [True] -+ }) -+ @requires_node -+ @no_wasm2js('wasm2js does not support reference types') -+ def test_externref2(self, dynlink): -+ self.emcc_args += ['-mreference-types'] -+ self.node_args.append("--experimental-wasm-reftypes") -+ if dynlink: -+ self.set_setting('MAIN_MODULE', 2) -+ self.do_core_test('test_externref2.c') -+ -+ - def test_syscall_intercept(self): - self.do_core_test('test_syscall_intercept.c') - --- -2.25.1 - diff --git a/packages/RobotRaconteur/meta.yaml b/packages/RobotRaconteur/meta.yaml index 229f9ef4a..3fcf7794b 100644 --- a/packages/RobotRaconteur/meta.yaml +++ b/packages/RobotRaconteur/meta.yaml @@ -26,30 +26,30 @@ build: -DPYTHON_INCLUDE_DIR=$PYTHONINCLUDE -DPYTHON_EXECUTABLE=python$PYMAJOR.$PYMINOR \ -DCMAKE_CXX_FLAGS="-fPIC -fexceptions -DBOOST_AP_DISABLE_THREADS=1 -O2 -DBOOST_BIND_GLOBAL_PLACEHOLDERS=1 -Wno-enum-constexpr-conversion" \ -DBOOST_INCLUDEDIR=$WASM_LIBRARY_DIR/include -DBOOST_LIBRARYDIR=$WASM_LIBRARY_DIR/lib \ - -DBoost_DATE_TIME_LIBRARY_RELEASE=$WASM_LIBRARY_DIR/lib/libboost_date_time.bc \ - -DBoost_DATE_TIME_LIBRARY_DEBUG=$WASM_LIBRARY_DIR/lib/libboost_date_time.bc \ - -DBoost_FILESYSTEM_LIBRARY_RELEASE=$WASM_LIBRARY_DIR/lib/libboost_filesystem.bc \ - -DBoost_FILESYSTEM_LIBRARY_DEBUG=$WASM_LIBRARY_DIR/lib/libboost_filesystem.bc \ - -DBoost_SYSTEM_LIBRARY_RELEASE=$WASM_LIBRARY_DIR/lib/libboost_system.bc \ - -DBoost_SYSTEM_LIBRARY_DEBUG=$WASM_LIBRARY_DIR/lib/libboost_system.bc \ - -DBoost_REGEX_LIBRARY_RELEASE=$WASM_LIBRARY_DIR/lib/libboost_regex.bc \ - -DBoost_SYSTEM_LIBRARY_DEBUG=$WASM_LIBRARY_DIR/lib/libboost_regex.bc \ - -DBoost_CHRONO_LIBRARY_RELEASE=$WASM_LIBRARY_DIR/lib/libboost_chrono.bc \ - -DBoost_CHRONO_LIBRARY_DEBUG=$WASM_LIBRARY_DIR/lib/libboost_crono.bc \ - -DBoost_RANDOM_LIBRARY_RELEASE=$WASM_LIBRARY_DIR/lib/libboost_random.bc \ - -DBoost_RANDOM_LIBRARY_DEBUG=$WASM_LIBRARY_DIR/lib/libboost_random.bc \ - -DBoost_PROGRAM_OPTIONS_LIBRARY_RELEASE=$WASM_LIBRARY_DIR/lib/libboost_program_options.bc \ - -DBoost_PROGRAM_OPTIONS_LIBRARY_DEBUG=$WASM_LIBRARY_DIR/lib/libboost_program_options.bc \ + -DBoost_DATE_TIME_LIBRARY_RELEASE=$WASM_LIBRARY_DIR/lib/libboost_date_time.a \ + -DBoost_DATE_TIME_LIBRARY_DEBUG=$WASM_LIBRARY_DIR/lib/libboost_date_time.a \ + -DBoost_FILESYSTEM_LIBRARY_RELEASE=$WASM_LIBRARY_DIR/lib/libboost_filesystem.a \ + -DBoost_FILESYSTEM_LIBRARY_DEBUG=$WASM_LIBRARY_DIR/lib/libboost_filesystem.a \ + -DBoost_SYSTEM_LIBRARY_RELEASE=$WASM_LIBRARY_DIR/lib/libboost_system.a \ + -DBoost_SYSTEM_LIBRARY_DEBUG=$WASM_LIBRARY_DIR/lib/libboost_system.a \ + -DBoost_REGEX_LIBRARY_RELEASE=$WASM_LIBRARY_DIR/lib/libboost_regex.a \ + -DBoost_SYSTEM_LIBRARY_DEBUG=$WASM_LIBRARY_DIR/lib/libboost_regex.a \ + -DBoost_CHRONO_LIBRARY_RELEASE=$WASM_LIBRARY_DIR/lib/libboost_chrono.a \ + -DBoost_CHRONO_LIBRARY_DEBUG=$WASM_LIBRARY_DIR/lib/libboost_crono.a \ + -DBoost_RANDOM_LIBRARY_RELEASE=$WASM_LIBRARY_DIR/lib/libboost_random.a \ + -DBoost_RANDOM_LIBRARY_DEBUG=$WASM_LIBRARY_DIR/lib/libboost_random.a \ + -DBoost_PROGRAM_OPTIONS_LIBRARY_RELEASE=$WASM_LIBRARY_DIR/lib/libboost_program_options.a \ + -DBoost_PROGRAM_OPTIONS_LIBRARY_DEBUG=$WASM_LIBRARY_DIR/lib/libboost_program_options.a \ -DUSE_PREGENERATED_SOURCE=ON \ . emmake make -j ${PYODIDE_JOBS:-3} emcc ${SIDE_MODULE_LDFLAGS} -fexceptions out/lib/libRobotRaconteurCore.a \ out/Python/RobotRaconteur/_RobotRaconteurPython.a \ - $WASM_LIBRARY_DIR/lib/libboost_chrono.bc \ - $WASM_LIBRARY_DIR/lib/libboost_date_time.bc \ - $WASM_LIBRARY_DIR/lib/libboost_filesystem.bc \ - $WASM_LIBRARY_DIR/lib/libboost_program_options.bc \ - $WASM_LIBRARY_DIR/lib/libboost_random.bc \ - $WASM_LIBRARY_DIR/lib/libboost_regex.bc \ - $WASM_LIBRARY_DIR/lib/libboost_system.bc \ + $WASM_LIBRARY_DIR/lib/libboost_chrono.a \ + $WASM_LIBRARY_DIR/lib/libboost_date_time.a \ + $WASM_LIBRARY_DIR/lib/libboost_filesystem.a \ + $WASM_LIBRARY_DIR/lib/libboost_program_options.a \ + $WASM_LIBRARY_DIR/lib/libboost_random.a \ + $WASM_LIBRARY_DIR/lib/libboost_regex.a \ + $WASM_LIBRARY_DIR/lib/libboost_system.a \ -o out/Python/RobotRaconteur/_RobotRaconteurPython.so diff --git a/packages/boost-cpp/meta.yaml b/packages/boost-cpp/meta.yaml index 321e70ff8..9106dd4a5 100644 --- a/packages/boost-cpp/meta.yaml +++ b/packages/boost-cpp/meta.yaml @@ -1,13 +1,11 @@ package: name: boost-cpp - version: 1.80.0 + version: 1.84.0 tag: - library source: - url: https://boostorg.jfrog.io/artifactory/main/release/1.80.0/source/boost_1_80_0.tar.gz - sha256: 4b2136f98bdd1f5857f1c3dea9ac2018effe65286cf251534b6ae20cc45e1847 - patches: - - patches/0001-config-libcpp15.patch + url: https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.gz + sha256: 4d27e9efed0f6f152dc28db6430b9d3dfb40c0345da7342eaa5a987dde57bd95 build: type: static_library @@ -15,7 +13,12 @@ build: export INSTALL_DIR=${WASM_LIBRARY_DIR} ./bootstrap.sh --prefix=${INSTALL_DIR} - ./b2 variant=release toolset=emscripten link=static threading=single \ + # https://github.com/emscripten-core/emscripten/issues/17052 + # Without this, boost outputs WASM modules not static library archives as an output. + # I don't understand why... the jam file used by boost is quite hard to understand. + printf "using clang : emscripten : emcc : emar emranlib emlink ;" | tee -a ./project-config.jam + + ./b2 variant=release toolset=clang-emscripten link=static threading=single \ --with-date_time --with-filesystem \ --with-system --with-regex --with-chrono --with-random --with-program_options --disable-icu \ cxxflags="$SIDE_MODULE_CXXFLAGS -fexceptions -DBOOST_SP_DISABLE_THREADS=1" \ diff --git a/packages/boost-cpp/patches/0001-config-libcpp15.patch b/packages/boost-cpp/patches/0001-config-libcpp15.patch deleted file mode 100644 index 7e4abc75c..000000000 --- a/packages/boost-cpp/patches/0001-config-libcpp15.patch +++ /dev/null @@ -1,30 +0,0 @@ -From de5ce13c939ef8fd581470eb712fd659475a9155 Mon Sep 17 00:00:00 2001 -From: ryanking13 -Date: Fri, 11 Nov 2022 11:50:42 +0900 -Subject: [PATCH 1/1] 0005-config-libcpp15 - ---- - include/boost/config/stdlib/libcpp.hpp | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/boost/config/stdlib/libcpp.hpp b/boost/config/stdlib/libcpp.hpp -index bc8536ea..0e9f2445 100644 ---- a/boost/config/stdlib/libcpp.hpp -+++ b/boost/config/stdlib/libcpp.hpp -@@ -168,4 +168,13 @@ - # define BOOST_NO_CXX14_HDR_SHARED_MUTEX - #endif - -+#if _LIBCPP_VERSION >= 15000 -+// -+// Unary function is now deprecated in C++11 and later: -+// -+#if __cplusplus >= 201103L -+#define BOOST_NO_CXX98_FUNCTION_BASE -+#endif -+#endif -+ - // --- end --- --- -2.29.2.windows.2 - diff --git a/packages/ffmpeg/meta.yaml b/packages/ffmpeg/meta.yaml index 461a5fe2d..2e8df09c3 100644 --- a/packages/ffmpeg/meta.yaml +++ b/packages/ffmpeg/meta.yaml @@ -20,6 +20,7 @@ build: --disable-pthreads \ --nm="$PYODIDE_ROOT/emsdk/emsdk/upstream/bin/llvm-nm -g" \ --ar=emar --cc=emcc --cxx=em++ --objcc=emcc --dep-cc=emcc --ranlib=emranlib \ + --enable-cross-compile \ --prefix=${WASM_LIBRARY_DIR} emmake make -j${PYODIDE_JOBS:-3} diff --git a/packages/gdal/meta.yaml b/packages/gdal/meta.yaml index ad164f7c3..c2f13a863 100644 --- a/packages/gdal/meta.yaml +++ b/packages/gdal/meta.yaml @@ -1,6 +1,6 @@ package: name: gdal - version: 3.5.1 + version: 3.5.2 tag: - library source: @@ -28,6 +28,11 @@ build: embuilder build libpng --pic embuilder build sqlite3 --pic + # LLVM bundled with Emscripten >= 3.1.47 has a parser bug regarding + # the comment. Until the bug is fixed, this is a temporary workaround to avoid the bug (removing comments). + # See: https://github.com/llvm/llvm-project/issues/67979 + sed -i -e 's|//.*||' -e 's|/\*.*\*/||' alg/gdalgeoloc.cpp + mkdir -p build cd build && emcmake cmake .. \ -DCMAKE_INSTALL_PREFIX=$WASM_LIBRARY_DIR \ diff --git a/packages/geos/meta.yaml b/packages/geos/meta.yaml index 60bd35de4..77d763dcb 100644 --- a/packages/geos/meta.yaml +++ b/packages/geos/meta.yaml @@ -1,11 +1,11 @@ package: name: geos - version: 3.10.3 + version: 3.12.1 tag: - library source: - url: http://download.osgeo.org/geos/geos-3.10.3.tar.bz2 - sha256: 3c141b07d61958a758345d5f54e3c735834b2f4303edb9f67fb26914f0d44770 + url: https://github.com/libgeos/geos/releases/download/3.12.1/geos-3.12.1.tar.bz2 + sha256: d6ea7e492224b51193e8244fe3ec17c4d44d0777f3c32ca4fb171140549a0d03 build: type: shared_library diff --git a/src/js/generated_struct_info32.json b/src/js/generated_struct_info32.json index 1fdeec5e7..db3eed100 100644 --- a/src/js/generated_struct_info32.json +++ b/src/js/generated_struct_info32.json @@ -202,20 +202,12 @@ "EMULTIHOP": 36, "EM_CALLBACK_THREAD_CONTEXT_CALLING_THREAD": 2, "EM_CALLBACK_THREAD_CONTEXT_MAIN_RUNTIME_THREAD": 1, - "EM_FUNC_SIG_I": 536870912, - "EM_FUNC_SIG_II": 570425344, - "EM_FUNC_SIG_III": 603979776, - "EM_FUNC_SIG_IIII": 637534208, "EM_FUNC_SIG_PARAM_B": 4, "EM_FUNC_SIG_PARAM_D": 3, "EM_FUNC_SIG_PARAM_F": 2, "EM_FUNC_SIG_PARAM_F2I": 5, "EM_FUNC_SIG_PARAM_I": 0, - "EM_FUNC_SIG_PARAM_I64": 1, - "EM_FUNC_SIG_V": 0, - "EM_FUNC_SIG_VI": 33554432, - "EM_FUNC_SIG_VII": 67108864, - "EM_FUNC_SIG_VIII": 100663296, + "EM_FUNC_SIG_PARAM_J": 1, "EM_HTML5_LONG_STRING_LEN_BYTES": 128, "EM_HTML5_MEDIUM_STRING_LEN_BYTES": 64, "EM_HTML5_SHORT_STRING_LEN_BYTES": 32, @@ -231,7 +223,6 @@ "EM_PROMISE_MATCH": 1, "EM_PROMISE_MATCH_RELEASE": 2, "EM_PROMISE_REJECT": 3, - "EM_PROXIED_RESIZE_OFFSCREENCANVAS": 654311424, "EM_TIMING_RAF": 1, "EM_TIMING_SETIMMEDIATE": 2, "EM_TIMING_SETTIMEOUT": 0, @@ -302,13 +293,13 @@ "F_DUPFD": 0, "F_GETFD": 1, "F_GETFL": 3, - "F_GETLK": 5, + "F_GETLK": 12, "F_GETOWN": 9, "F_GETOWN_EX": 16, "F_SETFD": 2, "F_SETFL": 4, - "F_SETLK": 6, - "F_SETLKW": 7, + "F_SETLK": 13, + "F_SETLKW": 14, "F_SETOWN": 8, "F_UNLCK": 2, "File::DataFileKind": 1, @@ -851,6 +842,13 @@ "size": 16, "usage": 8 }, + "WGPUBufferMapCallbackInfo": { + "__size__": 16, + "callback": 8, + "mode": 4, + "nextInChain": 0, + "userdata": 12 + }, "WGPUChainedStruct": { "__size__": 8, "next": 0, @@ -900,16 +898,15 @@ "utf16Offset": 56 }, "WGPUComputePassDescriptor": { - "__size__": 16, + "__size__": 12, "label": 4, "nextInChain": 0, - "timestampWriteCount": 8, - "timestampWrites": 12 + "timestampWrites": 8 }, - "WGPUComputePassTimestampWrite": { + "WGPUComputePassTimestampWrites": { "__size__": 12, - "location": 8, - "queryIndex": 4, + "beginningOfPassWriteIndex": 4, + "endOfPassWriteIndex": 8, "querySet": 0 }, "WGPUComputePipelineDescriptor": { @@ -946,8 +943,8 @@ "deviceLostUserdata": 32, "label": 4, "nextInChain": 0, + "requiredFeatureCount": 8, "requiredFeatures": 12, - "requiredFeaturesCount": 8, "requiredLimits": 16 }, "WGPUExtent3D": { @@ -966,6 +963,15 @@ "targetCount": 20, "targets": 24 }, + "WGPUFuture": { + "__size__": 8, + "id": 0 + }, + "WGPUFutureWaitInfo": { + "__size__": 16, + "completed": 8, + "future": 0 + }, "WGPUImageCopyBuffer": { "__size__": 40, "buffer": 32, @@ -981,9 +987,16 @@ "texture": 4 }, "WGPUInstanceDescriptor": { - "__size__": 4, + "__size__": 16, + "features": 4, "nextInChain": 0 }, + "WGPUInstanceFeatures": { + "__size__": 12, + "nextInChain": 0, + "timedWaitAnyEnable": 4, + "timedWaitAnyMaxCount": 8 + }, "WGPULimits": { "__size__": 144, "maxBindGroups": 16, @@ -1061,12 +1074,10 @@ "nextInChain": 0 }, "WGPUQuerySetDescriptor": { - "__size__": 24, + "__size__": 16, "count": 12, "label": 4, "nextInChain": 0, - "pipelineStatistics": 16, - "pipelineStatisticsCount": 20, "type": 8 }, "WGPUQueueDescriptor": { @@ -1074,29 +1085,37 @@ "label": 4, "nextInChain": 0 }, + "WGPUQueueWorkDoneCallbackInfo": { + "__size__": 16, + "callback": 8, + "mode": 4, + "nextInChain": 0, + "userdata": 12 + }, "WGPURenderBundleDescriptor": { "__size__": 8, "label": 4, "nextInChain": 0 }, "WGPURenderBundleEncoderDescriptor": { - "__size__": 28, + "__size__": 32, + "colorFormatCount": 8, "colorFormats": 12, - "colorFormatsCount": 8, "depthReadOnly": 24, "depthStencilFormat": 16, "label": 4, "nextInChain": 0, "sampleCount": 20, - "stencilReadOnly": 25 + "stencilReadOnly": 28 }, "WGPURenderPassColorAttachment": { "__size__": 56, "clearValue": 24, - "loadOp": 12, + "depthSlice": 8, + "loadOp": 16, "nextInChain": 0, - "resolveTarget": 8, - "storeOp": 16, + "resolveTarget": 12, + "storeOp": 20, "view": 4 }, "WGPURenderPassDepthStencilAttachment": { @@ -1112,25 +1131,24 @@ "view": 0 }, "WGPURenderPassDescriptor": { - "__size__": 32, + "__size__": 28, "colorAttachmentCount": 8, "colorAttachments": 12, "depthStencilAttachment": 16, "label": 4, "nextInChain": 0, "occlusionQuerySet": 20, - "timestampWriteCount": 24, - "timestampWrites": 28 + "timestampWrites": 24 }, "WGPURenderPassDescriptorMaxDrawCount": { "__size__": 16, "chain": 0, "maxDrawCount": 8 }, - "WGPURenderPassTimestampWrite": { + "WGPURenderPassTimestampWrites": { "__size__": 12, - "location": 8, - "queryIndex": 4, + "beginningOfPassWriteIndex": 4, + "endOfPassWriteIndex": 8, "querySet": 0 }, "WGPURenderPipelineDescriptor": { @@ -1144,10 +1162,17 @@ "primitive": 40, "vertex": 12 }, + "WGPURequestAdapterCallbackInfo": { + "__size__": 16, + "callback": 8, + "mode": 4, + "nextInChain": 0, + "userdata": 12 + }, "WGPURequestAdapterOptions": { - "__size__": 20, + "__size__": 24, "backendType": 12, - "compatibilityMode": 17, + "compatibilityMode": 20, "compatibleSurface": 4, "forceFallbackAdapter": 16, "nextInChain": 0, @@ -1240,6 +1265,11 @@ "sampleType": 4, "viewDimension": 8 }, + "WGPUTextureBindingViewDimensionDescriptor": { + "__size__": 12, + "chain": 0, + "textureBindingViewDimension": 8 + }, "WGPUTextureDataLayout": { "__size__": 24, "bytesPerRow": 16,