Open skhaz opened 11 months ago
I am following the README file, however for macOS it fails to link, step by step below.
export WASI_VERSION=20 export WASI_VERSION_FULL=${WASI_VERSION}.0 wget "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-macos.tar.gz" tar xvf "wasi-sdk-${WASI_VERSION_FULL}-macos.tar.gz"
The error.
/opt/workspace/personal/wasm/wasi-sdk-20.0/bin/clang --sysroot=/opt/workspace/personal/wasm/wasi-sdk-20.0/share/wasi-sysroot --target=wasm32 -Wl,--export-all -Wl,--no-entry -v main.c clang version 16.0.0 (https://github.com/llvm/llvm-project 08d094a0e457360ad8b94b017d2dc277e697ca76) Target: wasm32 Thread model: posix InstalledDir: /opt/workspace/personal/wasm/wasi-sdk-20.0/bin "/opt/workspace/personal/wasm/wasi-sdk-20.0/bin/clang-16" -cc1 -triple wasm32 -emit-obj -mrelax-all -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 -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -target-linker-version 820.1 -v -fcoverage-compilation-dir=/opt/workspace/personal/wasm -resource-dir /opt/workspace/personal/wasm/wasi-sdk-20.0/lib/clang/16 -isysroot /opt/workspace/personal/wasm/wasi-sdk-20.0/share/wasi-sysroot -internal-isystem /opt/workspace/personal/wasm/wasi-sdk-20.0/lib/clang/16/include -internal-isystem /opt/workspace/personal/wasm/wasi-sdk-20.0/share/wasi-sysroot/include -fdebug-compilation-dir=/opt/workspace/personal/wasm -ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -o /var/folders/35/9gkth5r11k77jyphrcjv7l9c0000gn/T/main-6b0364.o -x c main.c clang -cc1 version 16.0.0 based upon LLVM 16.0.0 default target wasm32-wasi #include "..." search starts here: #include <...> search starts here: /opt/workspace/personal/wasm/wasi-sdk-20.0/lib/clang/16/include /opt/workspace/personal/wasm/wasi-sdk-20.0/share/wasi-sysroot/include End of search list. "/opt/workspace/personal/wasm/wasi-sdk-20.0/bin/wasm-ld" -m wasm32 -L/opt/workspace/personal/wasm/wasi-sdk-20.0/share/wasi-sysroot/lib crt1.o --export-all --no-entry /var/folders/35/9gkth5r11k77jyphrcjv7l9c0000gn/T/main-6b0364.o -lc /opt/workspace/personal/wasm/wasi-sdk-20.0/lib/clang/16/lib/libclang_rt.builtins-wasm32.a -o a.out wasm-ld: error: cannot open crt1.o: No such file or directory wasm-ld: error: unable to find library -lc wasm-ld: error: cannot open /opt/workspace/personal/wasm/wasi-sdk-20.0/lib/clang/16/lib/libclang_rt.builtins-wasm32.a: No such file or directory clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
The error occurs because the path is incorrect, below is the correction.
.../lib/libclang_rt.builtins-wasm32.a
Should be.
.../lib/wasi/libclang_rt.builtins-wasm32.a
After copying it to a directory above, I get this error.
wasm-ld: error: cannot open crt1.o: No such file or directory wasm-ld: error: unable to find library -lc
PS.: Please put the commands with variables in double quotes, as ZSH escapes them when pasting and an error occurs.
you should use wasm32-wasi target instead.
wasm32-wasi
you don't need to specify sysroot or target as they are the default.
I am following the README file, however for macOS it fails to link, step by step below.
The error.
The error occurs because the path is incorrect, below is the correction.
Should be.
After copying it to a directory above, I get this error.
PS.: Please put the commands with variables in double quotes, as ZSH escapes them when pasting and an error occurs.