@@ -305,49 +305,21 @@ In the long term, we hope to implement stack switching ``stdin`` devices, but
305
305
that is out of scope for this PEP.
306
306
307
307
308
- Dynamic Libraries
309
- -----------------
310
-
311
- Main Thread Synchronous Loading Limit
312
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
313
-
314
- In the main browser thread, a dynamic library can only be loaded synchronously
315
- if it is at most 4 kilobytes. This excludes most nontrivial dynamic libraries.
316
- This limit is not present in Node.js and can be avoided by using a web worker. If
317
- stack switching is available, then it is possible to make ``dlopen() `` stack
318
- switch in order to instantiate a dynamic library synchronously.
319
-
320
- To avoid the synchronous loading limit, Pyodide currently preloads all dynamic
321
- libraries present in a wheel when installing the wheel (or on startup). This is
322
- a significant disadvantage with packages like SciPy that include a very large
323
- number of shared libraries that are expected to be only loaded on demand.
324
- Pyodide will implement a solution based on stack switching as it becomes more
325
- widely available in runtimes.
326
-
327
- Emscripten Python only loads extension module dynamic libraries when they are
328
- imported. This approach is simpler and more efficient when it works. The web
329
- example runs in a web worker and the cli runner runs in Node so neither of these
330
- have the synchronous loading limit. We will continue with this approach in
331
- Emscripten Python.
332
-
333
- In the long run, we hope to implement a stack switching ``dlopen ``, but that is
334
- out of scope for this PEP.
335
-
336
308
Missing RPATH Support
337
- ~~~~~~~~~~~~~~~~~~~~~
309
+ ---------------------
338
310
339
- Another important limitation of the Emscripten dynamic loader is that it does
340
- not currently have RPATH support. Pyodide's present workaround is as follows:
311
+ An important limitation of the Emscripten dynamic loader is that it does not
312
+ currently have RPATH support. Pyodide's present workaround is as follows:
341
313
``auditwheel-emscripten `` places shared library dependencies that are vendored
342
314
into a package in a ``${package}.libs `` folder, following auditwheel's
343
315
convention. Pyodide patches the dynamic loader to treat this ``${package}.libs ``
344
316
folder as if it were on the RPATH of all of the dynamic libraries in the wheel.
345
317
346
318
In Emscripten 4.0.5, we have updated the shared object file format, ``wasm-ld ``
347
319
and ``emcc `` to accept an ``-rpath `` flag. We are still working on updating the
348
- dynamic loader to respect the rpath, but we expect this will be finished in the
349
- next Emscripten release. Pyodide will then switch to using the RPATH and drop
350
- the patch on the dynamic loader.
320
+ dynamic loader to respect the rpath, but we expect this will be finished soon.
321
+ Pyodide will then switch to using the RPATH and drop the patch on the dynamic
322
+ loader.
351
323
352
324
Emscripten Python currently uses the unpatched dynamic loader and so cannot load
353
325
extension modules that depend on vendored dynamic libraries via DT_NEEDED.
0 commit comments