Stream: wasi

Topic: ✔ using a freshly-built wasi-sdk


view this post on Zulip Andy Wingo (Aug 14 2025 at 07:05):

hey tx for comments, fwiw I was just following wasi-sdk README; to build the toolchain:

cmake -G Ninja -B build/toolchain -S . -DWASI_SDK_BUILD_TOOLCHAIN=ON -DCMAKE_INSTALL_PREFIX=build/install
cmake --build build/toolchain --target install

Then to build the sysroot:

cmake -G Ninja -B build/sysroot -S . \
    -DCMAKE_INSTALL_PREFIX=build/install \
    -DCMAKE_TOOLCHAIN_FILE=build/install/share/cmake/wasi-sdk.cmake \
    -DCMAKE_C_COMPILER_WORKS=ON \
    -DCMAKE_CXX_COMPILER_WORKS=ON
cmake --build build/sysroot --target install

I was unable to find the combination of --sysroot and -resource-dir to produce a working in-tree toolchain yesterday; will spend a few minutes seeing if there is a fix, otherwise i will see about installing to /opt; will let you know.

view this post on Zulip Andy Wingo (Aug 14 2025 at 07:33):

ok, found out the deal: one must add -DWASI_SDK_INSTALL_TO_CLANG_RESOURCE_DIR=ON to the sysroot build. then the compiler appears to work fine without needing any --sysroot or -resource-dir flag

view this post on Zulip Notification Bot (Aug 14 2025 at 07:34):

Andy Wingo has marked this topic as resolved.


Last updated: Dec 06 2025 at 06:05 UTC