You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use --target=wasm32-wasip2-component as partially described in #426 to compile an empty C file with wasi-sdk 24.0 to a Wasi component, but it seems that it is having troubles finding the libraries for linking.
This is all the c file is:
intmain()
{
return0;
}
These are the results of running clang on it:
$ /opt/wasi-sdk/bin/clang ./component/main.c -o app.wasm --target=wasm32-wasip2-component -v
clang version 18.1.2-wasi-sdk (https://github.com/llvm/llvm-project 26a1d6601d727a96f4301d0d8647b5a42760ae0c)
Target: wasm32-unknown-wasip2-component
Thread model: posix
InstalledDir: /opt/wasi-sdk/bin
"/opt/wasi-sdk/bin/clang-18" -cc1 -triple wasm32-unknown-wasip2-component -emit-obj -mrelax-all -dumpdir app.wasm- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name main.c -mrelocation-model static -mframe-pointer=none -ffp-contract=on -fno-rounding-math -mconstructor-aliases -target-cpu generic -fvisibility=hidden -debugger-tuning=gdb -fdebug-compilation-dir=/home/kennan/programming/workbench-c -v -fcoverage-compilation-dir=/home/kennan/programming/workbench-c -resource-dir /opt/wasi-sdk/lib/clang/18 -isysroot /opt/wasi-sdk/bin/../share/wasi-sysroot -internal-isystem /opt/wasi-sdk/lib/clang/18/include -internal-isystem /opt/wasi-sdk/bin/../share/wasi-sysroot/include/wasm32-wasip2-component -internal-isystem /opt/wasi-sdk/bin/../share/wasi-sysroot/include -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -o /tmp/main-c7559e.o -x c ./component/main.c
clang -cc1 version 18.1.2-wasi-sdk based upon LLVM 18.1.2-wasi-sdk default target wasm32-wasi
ignoring nonexistent directory "/opt/wasi-sdk/bin/../share/wasi-sysroot/include/wasm32-wasip2-component"
#include "..." search starts here:
#include <...> search starts here:
/opt/wasi-sdk/lib/clang/18/include
/opt/wasi-sdk/bin/../share/wasi-sysroot/include
End of search list.
"/opt/wasi-sdk/bin/wasm-component-ld" -m wasm32 --wasm-ld-path /opt/wasi-sdk/bin/wasm-ld -L/opt/wasi-sdk/bin/../share/wasi-sysroot/lib/wasm32-wasip2-component crt1.o /tmp/main-c7559e.o -lc /opt/wasi-sdk/lib/clang/18/lib/wasip2/libclang_rt.builtins-wasm32.a -o app.wasm
wasm-ld: error: cannot open crt1.o: No such file or directory
wasm-ld: error: unable to find library -lc
error: failed to invoke LLD: exit status: 1
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Final goal is to compile a C file to component mode and import the Wasi clock and stdio dependencies, any help or direction would be greatly appreciated.
The text was updated successfully, but these errors were encountered:
Ah the target names of wasm32-wasip2-component and wasm32-wasip2-module are hypothetical names, not actual implemented names. This target is called wasm32-wasip2 (no suffix after that). This target emits a component at this time. Emitting a core wasm module, like the hypothetical wasm32-wasip2-module target, is not implemented at this time.
I'm trying to use
--target=wasm32-wasip2-component
as partially described in #426 to compile an empty C file with wasi-sdk 24.0 to a Wasi component, but it seems that it is having troubles finding the libraries for linking.This is all the c file is:
These are the results of running clang on it:
Final goal is to compile a C file to component mode and import the Wasi clock and stdio dependencies, any help or direction would be greatly appreciated.
The text was updated successfully, but these errors were encountered: