Skip to content

[wasm32-emscripten] Make EMSDK version part SOABI #96426

@tiran

Description

@tiran

Feature or enhancement

I propose to include the Emscripten SDK version in the SOABI for extensions and sysconfig.get_platform, which is used in wheel tag. I also propose to disable abi3.so for Emscripten.

Pitch

Typical compilers like gcc/clang and libcs like glibc provide a stable ABI. Modern VS and msvcrt also have a stable ABI. Code compiled with GCC 11 for glibc 2.34 generally works with code compiled with GCC 12 and glibc 2.35. The manylinux binary wheels make use of stable and common ABIs across Linux distros.

Emscripten does not provide a stable ABI for SIDE_MODULES (shared extensions) yet. That means Python packages must be compiled with exactly same version of EMSDK than the MAIN_MODULE, in our case the Python interpreter (python.wasm and python.js). An extension compiled with EMSDK 3.1.17 may or may not crash when it is loaded into a Python interpreter which is compiled with EMSDK 3.1.18.

If we include the EMSDK version in SOABI and wheel tag and disable abi3.so, then Python will only ever load extensions with compatible EMSDK version.

Implementation

  • in configure.ac include __EMSCRIPTEN_major__, minor, and tiny in PLATFORM_TRIPLET
  • in Python/dynload_shlib.c add #ifdef __EMSCRIPTEN__ around abi3.

tags

For technical reasons it is not possible to use a dot as version separator. We can either separate by _ or turn 3.1.18 into 30118.

  • wasm32_emscripten_3_1_18
  • wasm32_emscripten_30118

Previous discussion

emscripten-core/emscripten#15917

CC @hoodmane @rth @mdboom

Metadata

Metadata

Assignees

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions