[Pkg-rust-maintainers] Bug#1014567: Please ship instructions on how to use this package (and/or sysroot symlinks)

Faidon Liambotis paravoid at debian.org
Fri Jul 8 01:19:03 BST 2022


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 at 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



More information about the Pkg-rust-maintainers mailing list