diff --git a/Makefile.envs b/Makefile.envs index b9d170147..9f1f181b3 100644 --- a/Makefile.envs +++ b/Makefile.envs @@ -1,5 +1,5 @@ export PYVERSION ?= 3.10.2 -export PYODIDE_EMSCRIPTEN_VERSION ?= 2.0.16 +export PYODIDE_EMSCRIPTEN_VERSION ?= 2.0.24 # BASH_ENV tells bash to run pyodide_env.sh on startup, which sets various # environment variables. The next line instructs make to use bash to run each diff --git a/cpython/pyconfig.undefs.h b/cpython/pyconfig.undefs.h index 1cba442c0..9152fb3fb 100644 --- a/cpython/pyconfig.undefs.h +++ b/cpython/pyconfig.undefs.h @@ -21,6 +21,7 @@ #undef HAVE_PWRITEV #undef HAVE_PIPE2 #undef HAVE_NICE +#undef HAVE_EVENTFD /* Syscalls that resulted in a segfault */ #undef HAVE_UTIMENSAT diff --git a/emsdk/patches/0001-Throw-away-errors-in-minify_wasm_js.patch b/emsdk/patches/0001-Throw-away-errors-in-minify_wasm_js.patch index a898126fd..7f027ed84 100644 --- a/emsdk/patches/0001-Throw-away-errors-in-minify_wasm_js.patch +++ b/emsdk/patches/0001-Throw-away-errors-in-minify_wasm_js.patch @@ -1,17 +1,17 @@ -From 4e80e74b9bab27b583d350df3fbb0a444f56a178 Mon Sep 17 00:00:00 2001 +From 7b3ec4d7bfe4bd3b71fac9d9fedeee2fd3686391 Mon Sep 17 00:00:00 2001 From: Hood Date: Thu, 24 Jun 2021 04:08:02 -0700 -Subject: [PATCH 1/7] Throw away errors in minify_wasm_js +Subject: [PATCH 1/5] Throw away errors in minify_wasm_js --- emcc.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/emcc.py b/emcc.py -index 839f791b3..5653470dd 100755 +index 2653a23f2..e3ee515fc 100755 --- a/emcc.py +++ b/emcc.py -@@ -2901,11 +2901,14 @@ def do_binaryen(target, options, wasm_target): +@@ -3088,11 +3088,14 @@ def phase_binaryen(target, options, wasm_target): # Closure can print out readable error messages (Closure will then # minify whitespace afterwards) save_intermediate_with_wasm('preclean', wasm_target) @@ -30,7 +30,7 @@ index 839f791b3..5653470dd 100755 + pass save_intermediate_with_wasm('postclean', wasm_target) - if shared.Settings.ASYNCIFY_LAZY_LOAD_CODE: + if settings.ASYNCIFY_LAZY_LOAD_CODE: -- 2.25.1 diff --git a/emsdk/patches/0002-Add-support-for-preload-file-in-Node.js-11785.patch b/emsdk/patches/0002-Add-support-for-preload-file-in-Node.js-11785.patch deleted file mode 100644 index 6d3406b1c..000000000 --- a/emsdk/patches/0002-Add-support-for-preload-file-in-Node.js-11785.patch +++ /dev/null @@ -1,51 +0,0 @@ -From ac2fc760dd5eda8f999bcf4c40490ebe4442304f Mon Sep 17 00:00:00 2001 -From: Sam Clegg -Date: Thu, 3 Jun 2021 09:42:51 -0700 -Subject: [PATCH 2/7] Add support for `--preload-file` in Node.js (#11785) - -Note: this is included in emscripten 2.O.24 ---- - tools/file_packager.py | 15 ++++++++++++--- - 1 file changed, 12 insertions(+), 3 deletions(-) - -diff --git a/tools/file_packager.py b/tools/file_packager.py -index cd70b4b7d..fa5ad3ba5 100755 ---- a/tools/file_packager.py -+++ b/tools/file_packager.py -@@ -525,14 +525,12 @@ def main(): - remote_package_size = os.path.getsize(package_name) - remote_package_name = os.path.basename(package_name) - ret += r''' -- var PACKAGE_PATH; -+ var PACKAGE_PATH = ''; - if (typeof window === 'object') { - PACKAGE_PATH = window['encodeURIComponent'](window.location.pathname.toString().substring(0, window.location.pathname.toString().lastIndexOf('/')) + '/'); - } else if (typeof location !== 'undefined') { - // worker - PACKAGE_PATH = encodeURIComponent(location.pathname.toString().substring(0, location.pathname.toString().lastIndexOf('/')) + '/'); -- } else { -- throw 'using preloaded data can only be done on a web page or in a web worker'; - } - var PACKAGE_NAME = '%s'; - var REMOTE_PACKAGE_BASE = '%s'; -@@ -716,6 +714,17 @@ def main(): - - ret += r''' - function fetchRemotePackage(packageName, packageSize, callback, errback) { -+ if (typeof process === 'object') { -+ fs = require('fs'); -+ fs.readFile(packageName, function(err, contents) { -+ if (err) { -+ errback(err); -+ } else { -+ callback(contents.buffer); -+ } -+ }); -+ return; -+ } - var xhr = new XMLHttpRequest(); - xhr.open('GET', packageName, true); - xhr.responseType = 'arraybuffer'; --- -2.25.1 - diff --git a/emsdk/patches/0003-Fix-dup.patch b/emsdk/patches/0002-Fix-dup.patch similarity index 94% rename from emsdk/patches/0003-Fix-dup.patch rename to emsdk/patches/0002-Fix-dup.patch index fdc239218..add200c49 100644 --- a/emsdk/patches/0003-Fix-dup.patch +++ b/emsdk/patches/0002-Fix-dup.patch @@ -1,7 +1,7 @@ -From 64ad57cc02d9ce10ed71ba1a35e38c88369570c1 Mon Sep 17 00:00:00 2001 +From 3c19f54ad98ffa0143794986f001aedf8d7ca5e5 Mon Sep 17 00:00:00 2001 From: Hood Date: Wed, 8 Sep 2021 17:49:15 -0700 -Subject: [PATCH 3/7] Fix dup +Subject: [PATCH 2/5] Fix dup This fixes two problems with the `dup` system calls: 1. `dup` expects that every file descriptor has a corresponding file (so pipes and (https://github.com/emscripten-core/emscripten/issues/14640) @@ -17,10 +17,10 @@ This patch is simpler than the upstream one but leaves NODERAWFS broken. 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/library_fs.js b/src/library_fs.js -index 4ca59469c..519fab972 100644 +index cb077adbf..35cd816d2 100644 --- a/src/library_fs.js +++ b/src/library_fs.js -@@ -425,11 +425,16 @@ FS.staticInit();` + +@@ -429,11 +429,16 @@ FS.staticInit();` + }, isAppend: { get: function() { return (this.flags & {{{ cDefine('O_APPEND') }}}); } @@ -39,7 +39,7 @@ index 4ca59469c..519fab972 100644 newStream[p] = stream[p]; } diff --git a/src/library_syscall.js b/src/library_syscall.js -index 96d2ec0c3..0001624ec 100644 +index cb0e758c4..9b094a556 100644 --- a/src/library_syscall.js +++ b/src/library_syscall.js @@ -137,10 +137,10 @@ var SyscallsLibrary = { diff --git a/emsdk/patches/0004-Fix-side-module-exception-handling.patch b/emsdk/patches/0003-Fix-side-module-exception-handling.patch similarity index 83% rename from emsdk/patches/0004-Fix-side-module-exception-handling.patch rename to emsdk/patches/0003-Fix-side-module-exception-handling.patch index 58f0b4c9f..fa27808bd 100644 --- a/emsdk/patches/0004-Fix-side-module-exception-handling.patch +++ b/emsdk/patches/0003-Fix-side-module-exception-handling.patch @@ -1,7 +1,7 @@ -From a07a638594b7fcee4034d1fdae57276004955638 Mon Sep 17 00:00:00 2001 +From 4599cc51475c12c015672d2992c021b0a8d2eeaa Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Tue, 15 Feb 2022 23:27:03 -0500 -Subject: [PATCH 4/7] Fix side module exception handling +Subject: [PATCH 3/5] Fix side module exception handling See https://github.com/emscripten-core/emscripten/pull/16309 @@ -16,10 +16,10 @@ possible that a side module will need extra ones. This fixes the problem by upda 1 file changed, 3 insertions(+) diff --git a/src/library_dylink.js b/src/library_dylink.js -index 4a711296c..394342292 100644 +index da8809699..7a7fcb3d9 100644 --- a/src/library_dylink.js +++ b/src/library_dylink.js -@@ -41,6 +41,9 @@ var LibraryDylink = { +@@ -32,6 +32,9 @@ var LibraryDylink = { sym = createInvokeFunction(symName.split('_')[1]); } diff --git a/emsdk/patches/0006-Fix-pipe-close-operation-so-that-it-doesn-t-break-th.patch b/emsdk/patches/0004-Fix-pipe-close-operation-so-that-it-doesn-t-break-th.patch similarity index 87% rename from emsdk/patches/0006-Fix-pipe-close-operation-so-that-it-doesn-t-break-th.patch rename to emsdk/patches/0004-Fix-pipe-close-operation-so-that-it-doesn-t-break-th.patch index 655e47c2f..b3ae36930 100644 --- a/emsdk/patches/0006-Fix-pipe-close-operation-so-that-it-doesn-t-break-th.patch +++ b/emsdk/patches/0004-Fix-pipe-close-operation-so-that-it-doesn-t-break-th.patch @@ -1,7 +1,7 @@ -From 9dd481f6aed10fe4e6048b15c87b5bc91f225074 Mon Sep 17 00:00:00 2001 +From 452f4ae206b1c73a1288c028be64988f7ea82fde Mon Sep 17 00:00:00 2001 From: Hood Date: Sat, 17 Jul 2021 16:54:40 -0700 -Subject: [PATCH 6/7] Fix pipe close operation so that it doesn't break the +Subject: [PATCH 4/5] Fix pipe close operation so that it doesn't break the other side of the pipe --- diff --git a/emsdk/patches/0007-Fix-lookupPath-when-applied-to-a-symlink-loop.patch b/emsdk/patches/0005-Fix-lookupPath-when-applied-to-a-symlink-loop.patch similarity index 81% rename from emsdk/patches/0007-Fix-lookupPath-when-applied-to-a-symlink-loop.patch rename to emsdk/patches/0005-Fix-lookupPath-when-applied-to-a-symlink-loop.patch index 4e5b40ba8..28fd72437 100644 --- a/emsdk/patches/0007-Fix-lookupPath-when-applied-to-a-symlink-loop.patch +++ b/emsdk/patches/0005-Fix-lookupPath-when-applied-to-a-symlink-loop.patch @@ -1,7 +1,7 @@ -From c1120e713b28110945baeffdbd924aeac2ea4f26 Mon Sep 17 00:00:00 2001 +From 04a77fda1137c39bd068901ecb939dc0bff3e8e1 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Wed, 2 Mar 2022 13:44:14 -0800 -Subject: [PATCH 7/7] Fix lookupPath when applied to a symlink loop +Subject: [PATCH 5/5] Fix lookupPath when applied to a symlink loop The following code leads to an infinite loop in lookupPath: @@ -14,10 +14,10 @@ This patch fixes it. 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/library_fs.js b/src/library_fs.js -index 519fab972..ef91655f2 100644 +index 35cd816d2..d8eac9206 100644 --- a/src/library_fs.js +++ b/src/library_fs.js -@@ -169,7 +169,7 @@ FS.staticInit();` + +@@ -173,7 +173,7 @@ FS.staticInit();` + var link = FS.readlink(current_path); current_path = PATH_FS.resolve(PATH.dirname(current_path), link); diff --git a/emsdk/patches/0005-Update-upstream-URL-for-libjpeg.-NFC-13869.patch b/emsdk/patches/0005-Update-upstream-URL-for-libjpeg.-NFC-13869.patch deleted file mode 100644 index 7b0888231..000000000 --- a/emsdk/patches/0005-Update-upstream-URL-for-libjpeg.-NFC-13869.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 3b8024dd9ebe6c1161c99c9cc96ab20c8912eb4d Mon Sep 17 00:00:00 2001 -From: Sam Clegg -Date: Mon, 12 Apr 2021 09:27:04 -0700 -Subject: [PATCH 5/7] Update upstream URL for libjpeg. NFC (#13869) - -The old URL seems to be generating `Forbidden!`. - -I wonder if we should start maintaining our own mirror to avoid -this kind of thing. ---- - tools/ports/libjpeg.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tools/ports/libjpeg.py b/tools/ports/libjpeg.py -index f0deb7f4a..56926c841 100644 ---- a/tools/ports/libjpeg.py -+++ b/tools/ports/libjpeg.py -@@ -8,7 +8,7 @@ import shutil - import logging - - VERSION = '9c' --HASH = '2b581c60ae401a79bbbe748ff2deeda5acd50bfd2ea22e5926e36d34b9ebcffb6580b0ff48e972c1441583e30e21e1ea821ca0423f9c67ce08a31dffabdbe6b7' -+HASH = 'b2affe9a1688bd49fc033f4682c4a242d4ee612f1affaef532f5adcb4602efc4433c4a52a4b3d69e7440ff1f6413b1b041b419bc90efd6d697999961a9a6afb7' - - - def needed(settings): -@@ -16,7 +16,7 @@ def needed(settings): - - - def get(ports, settings, shared): -- ports.fetch_project('libjpeg', 'https://dl.bintray.com/homebrew/mirror/jpeg-9c.tar.gz', 'jpeg-9c', sha512hash=HASH) -+ ports.fetch_project('libjpeg', 'https://storage.googleapis.com/webassembly/emscripten-ports/jpegsrc.v9c.tar.gz', 'jpeg-9c', sha512hash=HASH) - - def create(final): - logging.info('building port: libjpeg') --- -2.25.1 - diff --git a/src/js/load-package.ts b/src/js/load-package.ts index d3f9f037a..6138d1be5 100644 --- a/src/js/load-package.ts +++ b/src/js/load-package.ts @@ -241,6 +241,7 @@ async function loadDynlib(lib: string, shared: boolean) { allowUndefined: true, }); Module.preloadedWasm[lib] = module; + Module.preloadedWasm[lib.split("/").pop()!] = module; if (shared) { Module.loadDynamicLibrary(lib, { global: true, diff --git a/src/tests/test_stdlib_fixes.py b/src/tests/test_stdlib_fixes.py index 07fb968e1..f9a367aa0 100644 --- a/src/tests/test_stdlib_fixes.py +++ b/src/tests/test_stdlib_fixes.py @@ -61,7 +61,7 @@ def test_multiprocessing(selenium): assert isinstance(res, int) assert res > 0 - msg = "Resource temporarily unavailable" + msg = "Function not implemented" with pytest.raises(selenium.JavascriptException, match=msg): selenium.run( """