emscripten-core / emscripten-core/emscripten
[Feature] Add option to link ports to SIDE_MODULE
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
**Version of emscripten/emsdk:**
3.1.19
In CPython we have an optional sqlite3 extension that is linked with libsqlite3. Currently the extension code and libsqlite3 is statically linked into the MAIN_MODULE. I like to split the extension off and load it as a shared extension (SIDE_MODULE). The extension is the only side module that will use libsqlite3. To reduce the size of the main module I would like to link libsqlite3 into the side module only.
However ` phase_calculate_system_libraries()` silently ignores all port dependencies like `-sUSE_SQLITE3` in the linking stage.
https://github.com/emscripten-core/emscripten/blob/2b9c6dd0833fdb620e9b8e596f4294243dd3fe2b/emcc.py#L2838-L2843
I would like to request an option that allows me to force ports into a side module, e.g. `if not settings.SIDE_MODULE or settings.SIDE_MODULE_FORCE_PORTS`.
Instead of an option I could hard code `-lsqlite3`. But that gets a bit awkward because threaded sqlite3 has a different library name...
Also see https://github.com/pyodide/pyodide/pull/2946
Contributor guide
Assessment
This issue has not been assessed yet.