Skip to content

Conversation

perseoGI
Copy link
Contributor

@perseoGI perseoGI commented Jun 24, 2025

Changelog: Feature: Added threads subsetting in emcc compiler model.
Docs: conan-io/docs#4115

Close #10088

The emcc compiler generates binaries that may be incompatible depending on whether threads are used. For more details, refer to the "Note" section in the Emscripten documentation: https://emscripten.org/docs/porting/pthreads.html#compiling-with-pthreads-enabled.

According to https://emscripten.org/docs/api_reference/wasm_workers.html:

Emscripten supports two multithreading APIs to utilize this web feature:

  • POSIX Threads (Pthreads) API
  • Wasm Workers API

These two APIs are incompatible with each other.

This incompatibility necessitates the modeling of threading usage within the compiler's binary model. This allows us to distinguish between binaries compiled with threading and those compiled without it. Our goal is to integrate this capability built in, as we strive to provide first-class support for the Emscripten ecosystem.


  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

@memsharded memsharded added this to the 2.18.0 milestone Jun 25, 2025
Copy link
Contributor

@franramirez688 franramirez688 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! But I'd like to see an integration test per toolchain 🙏

Copy link
Contributor

@franramirez688 franramirez688 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks! 👏

@franramirez688 franramirez688 merged commit 31b7ff0 into conan-io:develop2 Jun 25, 2025
15 checks passed
memsharded added a commit to memsharded/conan that referenced this pull request Jul 22, 2025
* Added threads subsetting on emcc compiler model

* Fixed test

* Return list instead

* Update test/integration/toolchains/meson/test_mesontoolchain.py

* Added integration tests to every toolchain

* WIP fix windows tests

* Fix windows autotools tests

---------

Co-authored-by: James <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature] Emscripten os.threads setting
3 participants