Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couldn't compile C code: pthread.h not found, need to enable minimal signal emulation #174

Closed
elimisteve opened this issue Feb 26, 2021 · 2 comments

Comments

@elimisteve
Copy link

Using wasi-sdk-12 on Linux:

$ clang cp-skip-unused.c -o demo.wasm
In file included from cp-skip-unused.c:171:
/opt/wasi-sdk/share/wasi-sysroot/include/signal.h:2:2: error: "wasm lacks signal support; to enable minimal signal emulation, compile with -D_WASI_EMULATED_SIGNAL and link with -lwasi-emulated-signal"
#error "wasm lacks signal support; to enable minimal signal emulation, \
 ^
cp-skip-unused.c:351:11: fatal error: 'pthread.h' file not found
        #include <pthread.h>
                 ^~~~~~~~~~~
2 errors generated.

How do I do this? I'm not sure what needs to be recompiled nor which compiler I needed to pass those flags to.

Thanks!

@pchickey
Copy link
Collaborator

If you want to use the minimal signal emulation, you'd invoke your clang like:

$ clang -D_WASI_EMULATED_SIGNAL -Wl,wasi-emulated-signal cp-skip-unused.c -o demo.wasm

Even with that minimal signal emulation, pthread.h won't be found. Wasm does not yet support threads so WASI does not support them, see also WebAssembly/WASI#296 #22

kildom pushed a commit to kildom/clang-wasi-port that referenced this issue Jul 14, 2021
Multi-license wasi-libc under the Apache-2.0 WITH LLVM-exception,
Apache-2.0, and MIT licenses.
@abrown
Copy link
Collaborator

abrown commented Mar 13, 2023

This should no longer be an issue: use the wasm32-wasi-threads target that has been worked on in many PRs by various people over the last few months. A pre-release for this functionality is available in the wasi-sdk-20+threads artifacts. (More instructions for how to use this new target are available here).

@abrown abrown closed this as completed Mar 13, 2023
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

No branches or pull requests

3 participants