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

signal header C++/WASI libc inconsistency (WASI SDK 8) #93

Closed
rene-fonseca opened this issue Jan 10, 2020 · 2 comments
Closed

signal header C++/WASI libc inconsistency (WASI SDK 8) #93

rene-fonseca opened this issue Jan 10, 2020 · 2 comments

Comments

@rene-fonseca
Copy link

There is an inconsistency in the signal headers for C++ vs C lib that causes build failure. Tested for WASI SDK 8.

Error from compiler:
/usr/local/wasi-sdk/share/wasi-sysroot/include/c++/v1/csignal:53:9: error: no member named 'signal' in the global namespace; did you mean 'sigval'?
using ::signal;

The WASI clib header (share/wasi-sysroot/include/signal.h) uses __wasilibc_unmodified_upstream to disable signal function:
#ifdef __wasilibc_unmodified_upstream /* WASI has no signals */
void (*signal(int, void (*)(int)))(int);
#endif

But the C++ csignal header (share/wasi-sysroot/include/c++/v1/csignal) refers to signal function always:
_LIBCPP_BEGIN_NAMESPACE_STD
using ::sig_atomic_t;
#ifdef __wasilibc_unmodified_upstream // ADDED BY ME
using ::signal;
#endif // ADDED BY ME
using ::raise;
_LIBCPP_END_NAMESPACE_STD

I just add __wasilibc_unmodified_upstream in csignal as a workaround for my build pipeline but likely better to add fake signal in WASI c lib to avoid modifying C++ llvm header? Not sure what is preferred.

@sbc100
Copy link
Member

sbc100 commented Jan 10, 2020

Interesting. I guess we need to choose between declare functions that don't exist at link time (we do this for raise() for example, although that is probably an oversight) and modifying libstdc++ sources.

Changing upstream libstdc++ is probably right way to go long term.

Alternatively, perhaps the best solution would be to simply remove signal.h and csignal completely from the SDK since we don't support any of the functions therein.

MaxDesiatov added a commit to swiftwasm/swift that referenced this issue Jul 14, 2020
Update WASI SDK to fix C++ setjmp/signal headers

Fixes the issue #595 with C++ packages for the development snapshots made from the `swiftwasm` branch. Previously C++ dependencies couldn't be built as default Clang headers weren't tailored to support WASI, WebAssembly/wasi-sdk#93 being one of the examples.

This should also unblock TokamakUI/Tokamak#170.
@abrown
Copy link
Collaborator

abrown commented Aug 8, 2023

Signals are now completely removed; this can be closed, right?

@abrown abrown closed this as completed Aug 8, 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