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
clang supports wasm{32,64}-unknown-unknown and wasm{32,64}-unknown-wasi compilation targets. And the WebAssembly project provides a C toolchain that provides a libc for things like malloc, free, io etc..
For our use-case this seems like a better approach than emscripten (which is a project more focused on generating WASM/JS for browser runtime).
The goal of this issue is to get the minic tests running in CI with clang compiler.
Setup WASM cross compilation toolchain
wasi-sdk publishes precompiled releases of the wasm toolchain. The libclang_rt.builtins-wasm32-wasi-15.0.tar.gz archive should be extracted in the clang installation root (e.g /usr/lib/clang/14 on Ubuntu). And the wasi-sysroot-15.0.tar.gz archive can be extracted anywhere locally.
Where /home/ubuntu/wasi-sysroot is the path where the sysroot archive was extracted to.
-nodefaultlibs -lc is important here because (on ubuntu, perhaps other linux systems) clang passes -lc -lgcc to the linker by default (and gcc lib is not available in the wasm sysroot).
The text was updated successfully, but these errors were encountered:
clang supports
wasm{32,64}-unknown-unknown
andwasm{32,64}-unknown-wasi
compilation targets. And the WebAssembly project provides a C toolchain that provides a libc for things like malloc, free, io etc..For our use-case this seems like a better approach than emscripten (which is a project more focused on generating WASM/JS for browser runtime).
The goal of this issue is to get the minic tests running in CI with clang compiler.
Setup WASM cross compilation toolchain
wasi-sdk publishes precompiled releases of the wasm toolchain. The
libclang_rt.builtins-wasm32-wasi-15.0.tar.gz
archive should be extracted in theclang
installation root (e.g/usr/lib/clang/14
on Ubuntu). And thewasi-sysroot-15.0.tar.gz
archive can be extracted anywhere locally.Clang can then be used as follows:
Where
/home/ubuntu/wasi-sysroot
is the path where the sysroot archive was extracted to.-nodefaultlibs -lc
is important here because (on ubuntu, perhaps other linux systems) clang passes-lc -lgcc
to the linker by default (andgcc
lib is not available in the wasm sysroot).The text was updated successfully, but these errors were encountered: