GNU bug report logs - #77653
[PATCH 0/4] Add WASM toolchain, wasi-libc, and browser WASM sandbox support

Previous Next

Package: guix-patches;

Reported by: Ian Eure <ian <at> retrospec.tv>

Date: Tue, 8 Apr 2025 19:58:02 UTC

Severity: normal

Tags: patch

Full log


Message #32 received at 77653 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Ian Eure <ian <at> retrospec.tv>
Cc: 77653 <at> debbugs.gnu.org
Subject: Re: [bug#77653] [PATCH 1/4] gnu: Add wasi-libc.
Date: Fri, 25 Apr 2025 17:02:15 +0900
Hello,

Ian Eure <ian <at> retrospec.tv> writes:

> * gnu/packages/wasm.scm (wasi-libc): New variable.

[...]

> +(define-public wasi-libc
> +  (package
> +    (name "wasi-libc")
> +    (version "sdk-20")

That's an odd version string.  Should we strip 'sdk-' and keep just
'20'?

> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/WebAssembly/wasi-libc")
> +                    (commit (string-append "wasi-" version))
> +                    (recursive? #t)))

The reason for using recursive? #t should be explained in a comment.
Typically these pull other package sources, which as a policy we'd
rather package separately.

> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +                "0knm5ch499dksmv1k0kh7356pjd9n1gjn0p3vp9bw57mn478zp8z"))))
> +    (build-system gnu-build-system)
> +    (native-inputs (list clang-16))
> +    (arguments
> +     (list #:tests? #f ;No test suite

nitpick: no need to punctuate margin comments (standalone comments, yes).

> +           ;; Firefox uses wasm2c to compile WebAssembly to C code, and it
> +           ;; does not support the memory.copy opcode.
> +           ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1773200#c4
> +           #:make-flags ''("BULK_MEMORY_SOURCES=")
> +           #:phases
> +           #~(modify-phases %standard-phases
> +               (delete 'configure)
> +               (add-before 'build 'set-sysroot-include
> +                 (lambda _
> +                   (setenv "C_INCLUDE_PATH"
> +                           (string-append (getcwd) "/sysroot/include"))))
> +               (add-before 'install 'set-install-dir
> +                 (lambda _
> +                   (setenv "INSTALL_DIR"
> +                           (string-append #$output "/wasm32-wasi")))))))

That's a strange (non-FHSish) place to put the result, no?  Should in go
to /lib/wasm32-wasi, perhaps?


> +    (home-page "https://wasi.dev")
> +    (synopsis "WASI libc implementation for WebAssembly")
> +    (description
> +     "WASI Libc is a libc for WebAssembly programs built on top of WASI
> +system calls.  It provides a wide array of POSIX-compatible C APIs, including
> +support for standard I/O, file I/O, filesystem manipulation, memory
> +management, time, string, environment variables, program startup, and many
> +other APIs.")

Please use 'file system' instead of filesystem, as a GNU convention.

-- 
Thanks,
Maxim




This bug report was last modified 43 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.