rutvora commented on Issue #603:
Hey, I'm facing a similar issue. Please comment the solution if you remember. Would be helpful.
Thanks
bjorn3 commented on Issue #603:
You must use the clang that is part of wasi-sdk, not your system clang.
rutvora commented on Issue #603:
I am using the wasi-sdk one
Here's my call
CC check-credentials/src/MD5.cpp -o MD5.wasm -nostartfiles -Wl,--no-entry,--export=GetMD5String -fno-exceptions --target=wasm32 -I ./wasi-sdk-11.0/share/wasi-sysroot/include/
where CC is[WASI_SDK_PATH]/bin/clang --sysroot=[WASI_SDK_PATH]/share/wasi-sysroot/
rutvora edited a comment on Issue #603:
I am using the wasi-sdk one
Here's my call
CC check-credentials/src/MD5.cpp -o MD5.wasm -nostartfiles -Wl,--no-entry,--export=GetMD5String -fno-exceptions --target=wasm32 -I ./wasi-sdk-11.0/share/wasi-sysroot/include/
where CC is[WASI_SDK_PATH]/bin/clang --sysroot=[WASI_SDK_PATH]/share/wasi-sysroot/
Btw, setting
--target=wasm32-wasi
or--target=wasm32-unknown-wasi
returns to me no available targets found compatible.
bjorn3 commented on Issue #603:
Does it work without the
--target
argument?
rutvora commented on Issue #603:
No, it gave a bunch of errors and a lot more warnings. All associated with wasi/api.h with the first error still being the same, that it is only available on WASI platforms.
rutvora commented on Issue #603:
it crashes on #ifndef __wasi__
Am I supposed to add an additional header somewhere in my code?
rutvora edited a comment on Issue #603:
it crashes on #ifndef \_\_wasi\_\_
Am I supposed to add an additional header somewhere in my code?
sunfishcode commented on Issue #603:
__wasi__
is predefined by clang when the target is wasm32-wasi. If--target=wasm32-wasi
says no targets found compatible, is it possible you're accidentally using some other clang, rather than the clang from the wasi-sdk package?
rutvora commented on Issue #603:
@sunfishcode I'm sure I'm calling the clang from WASI SDK. For reference, I have mentioned the command I used in a comment above. And I'm sure the env variable there points to the correct WASI_SDK directory.
I'm on MacOS Catalina, if that has some special conditions which I might have missed out on.
rutvora deleted a comment on Issue #603:
@sunfishcode I'm sure I'm calling the clang from WASI SDK. For reference, I have mentioned the command I used in a comment above. And I'm sure the env variable there points to the correct WASI_SDK directory.
I'm on MacOS Catalina, if that has some special conditions which I might have missed out on.
rutvora commented on Issue #603:
@sunfishcode I rechecked, turns out I wasn't. I was calling "[WASI_SDK_PATH]/bin/clang" (as a literal) and it defaulted to xCode Clang somehow :/
Thanks for the help though @bjorn3 and @sunfishcode
Last updated: Nov 22 2024 at 17:03 UTC