diff --git a/src/pyodide/BUILD.bazel b/src/pyodide/BUILD.bazel index 40b32e2c63d..853879396ad 100644 --- a/src/pyodide/BUILD.bazel +++ b/src/pyodide/BUILD.bazel @@ -121,6 +121,14 @@ if (typeof FinalizationRegistry === "undefined") { unregister(){} }; } + +function patchDynlibLookup(Module, libName) { + try { + return Module.FS.readFile("/usr/lib/" + libName); + } catch(e) { + console.log("Failed", e); + } +} """ REPLACEMENTS = [ @@ -169,6 +177,10 @@ REPLACEMENTS = [ "eval(UTF8ToString(ptr))", "(() => {throw new Error('Internal Emscripten code tried to eval, this should not happen, please file a bug report with your requirements.txt file\\'s contents')})()", ], + [ + "!libData&&flags.fs", + "!(libData ??= patchDynlibLookup(Module, libName))&&flags.fs" + ] ] expand_template(