Stream: wasi

Topic: dup in wasi-libc


view this post on Zulip Daniel Lim (Mar 28 2025 at 16:33):

Hi, I am trying to build FFmpeg 7.0 with wasi-sdk and unfortunate it failed due to an error saying call to undeclared function 'dup'. I understand from https://github.com/WebAssembly/wasi-libc/issues/459 that dup is currently not supported in wasi-libc.

May I know if there are plans to implement support for this syscall, or what are the reasons for not supporting it? I would like to help implement if it is doable.

Thanks.

Context Hello, I am trying to build yices2, (see there : https://github.com/sporniket/yices2-built-with-wasi-sdk ), I have tried wasi-sdk 19 and 20 without difference. So far, I have succesfully bu...

view this post on Zulip bjorn3 (Mar 28 2025 at 21:35):

wasip1 doesn't have any api equivalent to dup and it is unlikely that it will see new api's added. As for wasip2, there is no api for it either, but given that there is no direct correspondence between resource numbers and fd's anymore, I guess it would be possible for wasi-libc to emulate multiple fd's pointing to the same fd once wasi-libc natively implements wasip2 (currently it is implemented using an adapter from wasip1 to wasip2)

view this post on Zulip Daniel Lim (Mar 29 2025 at 05:00):

Thanks for the response. Out of curiosity, does this mean that dup might not be supported by wasi-libc in the near future? If so, are there any alternative solutions for compiling codebases that use dup?

Also, may I know where can I find information about configuring clang in the wasi-sdk to use wasip2 instead of wasi-libc?

Thank you very much for your help.


Last updated: Apr 08 2025 at 21:03 UTC