@@ -347,49 +347,21 @@ In the long term, we hope to implement stack switching ``stdin`` devices, but
347347that is out of scope for this PEP.
348348
349349
350- Dynamic Libraries
351- -----------------
352-
353- Main Thread Synchronous Loading Limit
354- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
355-
356- In the main browser thread, a dynamic library can only be loaded synchronously
357- if it is at most 4 kilobytes. This excludes most nontrivial dynamic libraries.
358- This limit is not present in Node.js and can be avoided by using a web worker. If
359- stack switching is available, then it is possible to make ``dlopen() `` stack
360- switch in order to instantiate a dynamic library synchronously.
361-
362- To avoid the synchronous loading limit, Pyodide currently preloads all dynamic
363- libraries present in a wheel when installing the wheel (or on startup). This is
364- a significant disadvantage with packages like SciPy that include a very large
365- number of shared libraries that are expected to be only loaded on demand.
366- Pyodide will implement a solution based on stack switching as it becomes more
367- widely available in runtimes.
368-
369- Emscripten Python only loads extension module dynamic libraries when they are
370- imported. This approach is simpler and more efficient when it works. The web
371- example runs in a web worker and the cli runner runs in Node so neither of these
372- have the synchronous loading limit. We will continue with this approach in
373- Emscripten Python.
374-
375- In the long run, we hope to implement a stack switching ``dlopen ``, but that is
376- out of scope for this PEP.
377-
378350Missing RPATH Support
379- ~~~~~~~~~~~~~~~~~~~~~
351+ ---------------------
380352
381- Another important limitation of the Emscripten dynamic loader is that it does
382- not currently have RPATH support. Pyodide's present workaround is as follows:
353+ An important limitation of the Emscripten dynamic loader is that it does not
354+ currently have RPATH support. Pyodide's present workaround is as follows:
383355``auditwheel-emscripten `` places shared library dependencies that are vendored
384356into a package in a ``${package}.libs `` folder, following auditwheel's
385357convention. Pyodide patches the dynamic loader to treat this ``${package}.libs ``
386358folder as if it were on the RPATH of all of the dynamic libraries in the wheel.
387359
388360In Emscripten 4.0.5, we have updated the shared object file format, ``wasm-ld ``
389361and ``emcc `` to accept an ``-rpath `` flag. We are still working on updating the
390- dynamic loader to respect the rpath, but we expect this will be finished in the
391- next Emscripten release. Pyodide will then switch to using the RPATH and drop
392- the patch on the dynamic loader.
362+ dynamic loader to respect the rpath, but we expect this will be finished soon.
363+ Pyodide will then switch to using the RPATH and drop the patch on the dynamic
364+ loader.
393365
394366Emscripten Python currently uses the unpatched dynamic loader and so cannot load
395367extension modules that depend on vendored dynamic libraries via DT_NEEDED.
0 commit comments