-
Notifications
You must be signed in to change notification settings - Fork 203
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
compiling cpp module with --target=wasm32-wasi results in fatal error: 'setjmp.h' file not found #432
Comments
The wask-sdk does not support setjmp or other non-local control flow concepts (such as C++ exceptions) yet because WebAssembly does not yet support such things. There are several proposals in the works that would enable these things, and if/when they get to certain point in the process wask-sdk/wask-libc will add support for setjmp. |
Apologies, on re-reading this does look like something that could probably be fixed. Most likely the correct solution is to patch libc++ headers to avoid including |
I was about to answer to your reply. Correct, I'm not trying to use set jump or exceptions. The code just fails to compile when using modules and std imports. It compiles with only modules use or std imports but not with both. I tried to supply setjmp.h from somewhere else but it brings more issues. cheers! |
Hello, Thks, |
* Avoid calling `poll_oneoff` with zero subscriptions. With WebAssembly/WASI#193 merged, WASI is moving to make `poll_oneoff` with no arguments an error. Even though that's in ephemeral and not yet in a snapshot, we can start to anticipate it in libc: - Remove the `pause` function, since WASI has no signals and thus no way to ever wake it up short of having the host terminate it. - Make `poll` and `pselect` return `ENOTSUP` in the case of having no events to wait for. * Remove `pause` from the defined-symbols.txt list. * Fix __wasilibc_unmodified_upstream markers. * Check for zero subscriptions, rather than zero events. Make `poll` and `pselect` return `ENOTSUP` when asked to poll on zero subscriptions, rather than when the systerm returns zero events. While here, drop the `__wasilibc_unmodified_upstream` markers, which were already pretty noisy here, and would be significantly worse with this change. * Add comments about the subtle relationship between nfds and nsubscriptions. * Rewrite the comment. * Fix code quotes.
@djabi: is this still an issue? I was going to recommend moving this issue over to https://github.com/WebAssembly/wasi-libc in order to include a stubbed-out version of |
I'm still getting this error.
|
@paulcdejean, I don't think what you're observing is the same thing. It looks like you are trying to compile Wasmtime ( I guess I really need to know if this is still a problem for general C/C++ code that we do expect to compile to WebAssembly. |
Maybe the problem mentionned there : WebAssembly/wasi-libc#432
I guess I am experiencing this problem, trying to build yices2 : https://github.com/sporniket/yices2-built-with-wasi-sdk I end up with "no rule to make 'setjmp.h' required by xxx" |
Compiling a simple module that touches std namespace will cause /opt/wasi-sdk/share/wasi-sysroot/include/c++/v1/setjmp.h:34:15: fatal error: 'setjmp.h' file not found
The same code works w/o using -fmodule and without import header. I can reproduce this on both Ubuntu 20.04 and MacOS 10.15.7. Here is the module source file foo.cpp:
foo.cpp:
I'm using the precompiles wasi sdk https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-11/wasi-sdk_11.0_amd64_ubuntu20.04.deb on ubunty 20.04.
Installed with
$ sudo apt install ./wasi-sdk_11.0_amd64_ubuntu20.04.deb
$ sudo apt install libncurses5
x@pirin:~/setjmp_bug$ /opt/wasi-sdk/bin/clang++ -v -std=c++20 -fmodules --precompile -c foo.cpp -o foo.pcm
clang version 10.0.0 (https://github.com/llvm/llvm-project d32170dbd5b0d54436537b6b75beaf44324e0c28)
Target: wasm32-unknown-wasi
Thread model: posix
InstalledDir: /opt/wasi-sdk/bin
(in-process)
"/opt/wasi-sdk/bin/clang-10" -cc1 -triple wasm32-unknown-wasi -E -disable-free -disable-llvm-verifier -discard-value-names -main-file-name foo.cpp -mrelocation-model static -mthread-model posix -mframe-pointer=none -fno-rounding-math -masm-verbose -mconstructor-aliases -target-cpu generic -fvisibility hidden -dwarf-column-info -debugger-tuning=gdb -v -resource-dir /opt/wasi-sdk/lib/clang/10.0.0 -isysroot /opt/wasi-sdk/share/wasi-sysroot -internal-isystem /opt/wasi-sdk/share/wasi-sysroot/include/wasm32-wasi/c++/v1 -internal-isystem /opt/wasi-sdk/share/wasi-sysroot/include/c++/v1 -internal-isystem /opt/wasi-sdk/lib/clang/10.0.0/include -internal-isystem /opt/wasi-sdk/share/wasi-sysroot/include/wasm32-wasi -internal-isystem /opt/wasi-sdk/share/wasi-sysroot/include -std=c++20 -fdeprecated-macro -fdebug-compilation-dir /home/x/setjmp_bug -ferror-limit 19 -fmessage-length 0 -fgnuc-version=4.2.1 -fmodules -fimplicit-module-maps -fmodules-cache-path=/tmp/org.llvm.clang.x/ModuleCache -fmodules-validate-system-headers -fobjc-runtime=gnustep -fcxx-exceptions -fexceptions -fno-common -fdiagnostics-show-option -fcolor-diagnostics -o foo.pcm -x c++ foo.cpp
clang -cc1 version 10.0.0 based upon LLVM 10.0.0 default target wasm32-wasi
ignoring nonexistent directory "/opt/wasi-sdk/share/wasi-sysroot/include/wasm32-wasi/c++/v1"
ignoring nonexistent directory "/opt/wasi-sdk/share/wasi-sysroot/include/wasm32-wasi"
#include "..." search starts here:
#include <...> search starts here:
/opt/wasi-sdk/share/wasi-sysroot/include/c++/v1
/opt/wasi-sdk/lib/clang/10.0.0/include
/opt/wasi-sdk/share/wasi-sysroot/include
End of search list.
clang -cc1 version 10.0.0 based upon LLVM 10.0.0 default target wasm32-wasi
ignoring nonexistent directory "/opt/wasi-sdk/share/wasi-sysroot/include/wasm32-wasi/c++/v1"
ignoring nonexistent directory "/opt/wasi-sdk/share/wasi-sysroot/include/wasm32-wasi"
#include "..." search starts here:
#include <...> search starts here:
/opt/wasi-sdk/share/wasi-sysroot/include/c++/v1
/opt/wasi-sdk/lib/clang/10.0.0/include
/opt/wasi-sdk/share/wasi-sysroot/include
End of search list.
While building module 'std' imported from foo.cpp:2:
In file included from :20:
/opt/wasi-sdk/share/wasi-sysroot/include/c++/v1/setjmp.h:34:15: fatal error: 'setjmp.h' file not found
#include_next <setjmp.h>
^~~~~~~~~~
foo.cpp:2:8: fatal error: could not build module 'std'
import "string"
The text was updated successfully, but these errors were encountered: