reproc: Emscripten is not supported with multithread (pthread flags is set on example but not on the library)
Resulting ld bug:
> wasm-ld: error: 'atomics' feature is used by d1_lib.o, so --shared-memory
> must be used
>
> This one means that `dl_lib.o` was compiled with -pthread already
> (-pthread enables the 'atomics' feature), so its atomic operations have
> been lowered to real atomic WebAssembly instructions. However, because
> you're not passing -pthread at link time, the linker tries to produce a
> module with an unshared memory, which would make those atomic instructions
> invalid.
>
> wasm-ld: error: Target feature 'atomics' used in d1_lib.o is disallowed by
> ConcurrentScheduler.cpp.o. Use --no-check-features to suppress.
>
> This line tells us that ConcurrentScheduler.cpp.o was compiled without
> -pthread, which means its atomic operations were lowered to non-atomic
> WebAssembly instruction because the atomics feature was not enabled. That
> means that ConcurrentScheduler.cpp.o is not safe to link with dl_lib.o
> because the resulting program would not be thread-safe, even if the program
> was thread-safe at the source level. When using the LLVM backend, the
> wasm-ld linker helpfully recognizes this error and does not let you link an
> unsafe program. Fastcomp would just silently link your program into a
> thread-unsafe binary.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (14 by maintainers)
Commits related to this issue
- Allow linking against the system's thread library on all platforms. See #24 for more information. — committed to DaanDeMeyer/reproc by DaanDeMeyer 5 years ago
- Allow linking against the system's thread library on all platforms. See #24 for more information. — committed to DaanDeMeyer/reproc by DaanDeMeyer 5 years ago
working.
Yes, the linker will complain if you mix files with different wasm feature sets. So all files should be built with pthreads support, or none.