Skip to content

[feature] Emscripten os.threads setting #10088

@Rogiel

Description

@Rogiel

Emscripten binaries are incompatible if they were build with some flags that don't match. For instance -s USE_PTHREADS=1 is incompatible with libraries without it. Mismatching libraries will fail with the following:

wasm-ld: error: --shared-memory is disallowed by spdlog.cpp.o because it was not compiled with 'atomics' or 'bulk-memory' features.

I'm considering implementing os.threads=True that should correctly set the flags. To implement this, we would need to add a new entry in settings.yml and append -s USE_PTHREADS=1/0 depending on the value of os.threads.

I'm not 100% sure how to proceed with the handling of the flags. I have a working hack that allows setting it for CMake by appending the flag to CONAN_C/CXX_FLAGS in cmake_flags.py, by checking the platform and threads setting. This obviously will only work for CMake, but a similar patch is required for autoconf and other supported toolchains.

I'm unsure what the policy is on adding C/CXX flags, since it's very rarely done in Conan, if there's another better path to take for this, please let me know. Any help and guidelines on how to proceed with implementing this would be greatly appreciated.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions