Your message dated Sat, 31 Dec 2022 17:30:06 +0200
with message-id <[email protected]>
and subject line Re: Bug#1014567: Please ship instructions on how to use this 
package (and/or sysroot symlinks)
has caused the Debian Bug report #1014567,
regarding Please ship instructions on how to use this package (and/or sysroot 
symlinks)
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1014567: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1014567
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: wasi-libc
Version: 0.0~git20210922.ad51334-1
Severity: normal

Thank you for maintaining wasi-libc!

I am trying to use Debian's clang + wasi-libc to compile a C program
into a WASM WASI binary. I am struggling to understand how to exactly
use wasi-libc. Most instructions on the web assume one is downloading
the WASI SDK, and operating based on its sysroot structure.

So far, I have succeeded by creating the following symlink structure:
  root@7c3f1d075193:~# find /opt/wasi-sysroot/ -ls
   23595890 4 drwxr-xr-x   3 root root  4096 Jul  7 21:09 /opt/wasi-sysroot/
   23595893 4 drwxr-xr-x   2 root root  4096 Jul  7 21:09 /opt/wasi-sysroot/lib
   23595894 0 lrwxrwxrwx   1 root root    20 Jul  7 21:09 
/opt/wasi-sysroot/lib/wasm32-wasi -> /usr/lib/wasm32-wasi
   23595892 0 lrwxrwxrwx   1 root root    24 Jul  7 21:09 
/opt/wasi-sysroot/include -> /usr/include/wasm32-wasi
   23595891 0 lrwxrwxrwx   1 root root    22 Jul  7 21:09 
/opt/wasi-sysroot/share -> /usr/share/wasm32-wasi

...and then invoking clang with --sysroot=/opt/wasi-sysroot.

It'd be great if the package shipped with such a symlink structure,
and/or came with instructions on how one can use this package (either
with this structure, or, if possible, without).

For what it's worth, wasi-libc is only one part of the puzzle. I also needed
to also fetch compiler-rt e.g. from wasi-sdk (cf. #1010932). My full
command-line is:
  clang --target=wasm32-wasi \
        --rtlib=compiler-rt \
        --sysroot=/opt/wasi-sysroot \
        helloworld.c -o helloworld.wasm

Thanks!
Faidon

--- End Message ---
--- Begin Message ---
On Fri, Jul 08, 2022 at 03:19:03AM +0300, Faidon Liambotis wrote:
> I am trying to use Debian's clang + wasi-libc to compile a C program
> into a WASM WASI binary. I am struggling to understand how to exactly
> use wasi-libc. Most instructions on the web assume one is downloading
> the WASI SDK, and operating based on its sysroot structure.
> 
> [...]
> 
> For what it's worth, wasi-libc is only one part of the puzzle. I also needed
> to also fetch compiler-rt e.g. from wasi-sdk (cf. #1010932). My full
> command-line is:
>   clang --target=wasm32-wasi \
>         --rtlib=compiler-rt \
>       --sysroot=/opt/wasi-sysroot \
>       helloworld.c -o helloworld.wasm

This was quite the rabbit hole: I made (quite) a few changes to the LLVM
package, most of them currently in experimental, 1:14.0.6-10~exp5 or
thereabouts, and now everything should work out of the box:

  apt install -t experimental clang-14 lld-14 libclang-rt-14-dev-wasm32 
wasi-libc
  clang-14 --target=wasm32-wasi helloworld.c -o helloworld.wasm

I think we can close this bug, as it's obvious enough that no
instructions will be necessary.

Regards,
Faidon

--- End Message ---

Reply via email to