Stream: wasi

Topic: ✔ Linking with clang fails when compiling to wasm32-wasip2


view this post on Zulip Notification Bot (Apr 21 2025 at 18:18):

Lukas has marked this topic as resolved.

view this post on Zulip Victor Adossi (Apr 23 2025 at 14:06):

Hey @Lukas glad you were able to get this fixed! Would you mind expanding on your solution for people who might find this in the future?

view this post on Zulip Lukas (Apr 24 2025 at 06:36):

Ah yes, of course, I planned on doing that. So I think one issue is that the wasi-sdk uses wasi version 0.2.0, downgrading all dependencies to use exactly 0.2.0 resolved the issue. (That's already probably a bug)

However, there were other link-time issues remaining, so the way to go for these was to use rust-lld again as linker, and not clang, but explicitly providing needed libraries with -Clink-arg=-L/opt/wasi-sdk/share/wasi-sysroot/lib/wasm32-wasip2.

The entire discussion can be found here

I'm trying to compile moshi to wasm32-wasip2. I had to patch several dependencies, but all of them compile now. My issue is at linktime. I'm using rust nightly, and have the wasi-sdk installed unde...

view this post on Zulip Ramon Klass (Apr 24 2025 at 11:44):

for the record, similar linker flags are also needed for wasip1 when compiling C++ libraries so that rust-lld can find libc++, I just never checked if that's documented anywhere since it seemed like the obvious thing to do with linker errors


Last updated: Dec 06 2025 at 06:05 UTC