Message ID | 20250408195830.2084-2-ian@retrospec.tv |
---|---|
State | New |
Headers |
Return-Path: <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4374127BC4E; Tue, 8 Apr 2025 20:59:28 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D6B7427BC4A for <patchwork@mira.cbaines.net>; Tue, 8 Apr 2025 20:59:27 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guix-patches-bounces@gnu.org>) id 1u2F6I-0007Md-TM; Tue, 08 Apr 2025 15:59:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1u2F68-0007EV-VX for guix-patches@gnu.org; Tue, 08 Apr 2025 15:59:05 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1u2F66-0003Rt-RP for guix-patches@gnu.org; Tue, 08 Apr 2025 15:59:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=MhWjfuDkwmIihm2LinIJt4s354N2QSFCeszYtmRdYsE=; b=PxLPAkASg26dwPDbmxzwlSjuiAJ3hfkEjHodxk5ObkYOdW0uT7uw4iG16ClSFftEGzEUYZ/aevL5quOy/9mo4He1YGJ+XZy/35i5twDad5JoAiFxkskCkfHWkKNYqH9NNvIIW0aZGw4wZ1xTePbFiPPw6CVGVh7S/nLTfToK+4z/y82JoNQf4KUkftLBejZ4bPoAJeEfb6yGqVCfDknu4jgbAxGZskZV1RUpxPEv85MLVcsjJTjumm7yjTN6tlYyWzbi40lAkHpEmQzcO1Z/fMuQMUo1ake1aTHQ7aMM8FiB6SuguF4TGXUowfwkIMISPeyuvMpWhMwLBZhbQIspIA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1u2F66-0000Mq-Il for guix-patches@gnu.org; Tue, 08 Apr 2025 15:59:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77653] [PATCH 2/4] gnu: Add wasm32-wasi-clang-runtime. Resent-From: Ian Eure <ian@retrospec.tv> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 08 Apr 2025 19:59:02 +0000 Resent-Message-ID: <handler.77653.B77653.17441423241349@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77653 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77653@debbugs.gnu.org Cc: Ian Eure <ian@retrospec.tv> Received: via spool by 77653-submit@debbugs.gnu.org id=B77653.17441423241349 (code B ref 77653); Tue, 08 Apr 2025 19:59:02 +0000 Received: (at 77653) by debbugs.gnu.org; 8 Apr 2025 19:58:44 +0000 Received: from localhost ([127.0.0.1]:35615 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1u2F5n-0000Lg-Hz for submit@debbugs.gnu.org; Tue, 08 Apr 2025 15:58:43 -0400 Received: from fout-a4-smtp.messagingengine.com ([103.168.172.147]:42083) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <ian@retrospec.tv>) id 1u2F5k-0000LA-OR for 77653@debbugs.gnu.org; Tue, 08 Apr 2025 15:58:41 -0400 Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id 7EF8B13801BF; Tue, 8 Apr 2025 15:58:35 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Tue, 08 Apr 2025 15:58:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=retrospec.tv; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1744142315; x= 1744228715; bh=MhWjfuDkwmIihm2LinIJt4s354N2QSFCeszYtmRdYsE=; b=F q1tkOJrbq1k+ORSQxDj3nGr1AO6kuOQWpEml2MXuDHXTPZpGMnh019/J/nBMxhCI zDNLcn47zxgqgggl82eHPKhZstWMn3M5NSlFx0pPaencb5ttWUdoYknMDUqH9YpY 2a+PtVccyYPd0iV02o8IX9aAQRhBul3bLkNZpLJkMPoi3Mp8naiAK5+qdqNeKGII OLRu7fplY9Dw0Hqkt8UclSaGxg25OTJgGxM8wYQoIx6o7v+G0/kbr8sYUA2CeGCB 8hbg7ExFT/v9NTrumdyQ6Eyfzf7yMUS6Js+akpAgZ+8sebAHL6zNDdfqgADcCo77 QFsbAkdnQYG5koZ86mzzw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1744142315; x=1744228715; bh=M hWjfuDkwmIihm2LinIJt4s354N2QSFCeszYtmRdYsE=; b=Q1O3e51sUedVZMXei MoZQslqknn0EdE8XrQi2u9D42VmlTwkRYfHVEa2/KuXKLuxxrNI/EIgTBc1esql4 8GcaVtICxRNLfckbMZqieqd5/62h4Hf3mqqcC7hn/gBRpbo/Clu8wuzNLVEAgHwS Rq89vY05aGKN9JoojK0kErY/oLYpBYqo2O9jo3JumYMT5RBb0guHtVnTPAk7K04U XmYnVJfxC2/y6LfHbFmsXPtqYGPo5Thi+w+gxJQNx9HWc+64ZsYuVpRgt7spd090 WxNT2FUK9BcbdOCQfbeoL+rZxot3n0NkOhl6eCbscACTeoEYxDynjEDJSiK5mGy9 TndMw== X-ME-Sender: <xms:63_1Z0RgqZCepUpGgZcjook_I9QgkGVrrqqnAr6NNTpmiJg6YiiISA> <xme:63_1ZxwxQcOG5My37lg8F_gMcCgzLBPD76vYhw4XFyz0tNtojeH-AsCQAmnYbNsd3 1n2mIADlAICuh111w> X-ME-Received: <xmr:63_1Zx1pETqZFomQc4rIA4dHrO6PIm22web6FbCbSu4fHKh4bsk6bIA-j2uNm91ZofOY3ULu0WkU4dmnMlKRBjMAAzZ6KS_jnwYl6LKpQs1tLerJjgsLDA> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvtdefleelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvf evufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefkrghnucfguhhrvgcuoehi rghnsehrvghtrhhoshhpvggtrdhtvheqnecuggftrfgrthhtvghrnhepveevjeffuddvte eiueetgfeukedvfeeiuedvveelfeeghfduleeftedvgfefgeejnecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihgrnhesrhgvthhrohhsphgvtg drthhvpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthho peejjeeiheefseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepihgrnhesrh gvthhrohhsphgvtgdrthhv X-ME-Proxy: <xmx:63_1Z4A7ea_C_YQAFQPwzv-_mAqHYxCdIOebVLJipR7TB2OdHkZHVQ> <xmx:63_1Z9gZV7g2mo0ClHYpkYhAzk8HMe41UB93FiLIAB3rE-w9r-RqJw> <xmx:63_1Z0qtVGKCmFUYsx9RSFk7Npd6V5i1TdZhSACFjq6Ujg93N7wUGA> <xmx:63_1ZwjWk1ATu9z6mPH87oTSgHKsJSkqctFOpwvLyosxKGfDoEAemQ> <xmx:63_1ZwhifNhx0IDktK5plmUs11wBaYfSc4x3Swc_1eI8nt2nCvQ_Lhuv> Feedback-ID: id9014242:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 8 Apr 2025 15:58:34 -0400 (EDT) From: Ian Eure <ian@retrospec.tv> Date: Tue, 8 Apr 2025 12:58:27 -0700 Message-ID: <20250408195830.2084-2-ian@retrospec.tv> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250408195830.2084-1-ian@retrospec.tv> References: <20250408195830.2084-1-ian@retrospec.tv> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: <guix-patches.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guix-patches> List-Post: <mailto:guix-patches@gnu.org> List-Help: <mailto:guix-patches-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=subscribe> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches |
Series |
Add WASM toolchain, wasi-libc, and browser WASM sandbox support
|
|
Commit Message
Ian Eure
April 8, 2025, 7:58 p.m. UTC
* gnu/packages/wasm.scm (wasm32-wasi-clang-runtime): New variable. Change-Id: Ib0465fdc86086451782d533380a8966cdde6dc1e --- gnu/packages/wasm.scm | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
Comments
Ian Eure <ian@retrospec.tv> writes: > * gnu/packages/wasm.scm (wasm32-wasi-clang-runtime): New variable. > > Change-Id: Ib0465fdc86086451782d533380a8966cdde6dc1e > --- > gnu/packages/wasm.scm | 30 ++++++++++++++++++++++++++++++ > 1 file changed, 30 insertions(+) > > diff --git a/gnu/packages/wasm.scm b/gnu/packages/wasm.scm > index 060e1e420f..53ea31f4a7 100644 > --- a/gnu/packages/wasm.scm > +++ b/gnu/packages/wasm.scm > @@ -76,3 +76,33 @@ (define-public wasi-libc > license:bsd-2 > ;; For wasi-libc and musl-libc. > license:expat)))) > + > +(define-public wasm32-wasi-clang-runtime > + (package (inherit clang-runtime-16) Please add a line break (package (inherit clang-runtime-16) .... ) > + (native-inputs > + (list clang-16 > + wasi-libc)) Should wasi-libc be placed in inputs? > + (inputs (list llvm-16)) > + (arguments > + (list > + #:build-type "Release" > + #:tests? #f > + ;; Stripping binaries breaks wasm linking, resulting in the following > + ;; error: "archive has no index; run ranlib to add one". > + #:strip-binaries? #f > + #:configure-flags > + #~(list "-DCMAKE_C_COMPILER=clang" > + "-DCMAKE_C_COMPILER_TARGET=wasm32-wasi" > + (string-append > + "-DCMAKE_SYSROOT=" #$wasi-libc "/wasm32-wasi") (this-package-native-input "wasi-libc") > + (string-append > + "-DCMAKE_C_FLAGS=-I " #$wasi-libc "/wasm32-wasi/include") (this-package-native-input "wasi-libc") > + > + "-DCOMPILER_RT_OS_DIR=wasi" > + > + "-DCOMPILER_RT_BAREMETAL_BUILD=On" > + "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=On" > + > + ;; WASM only needs libclang_rt.builtins-wasm32.a from > + ;; compiler-rt. > + "../source/compiler-rt/lib/builtins")))))
Hi, Ian Eure <ian@retrospec.tv> writes: > * gnu/packages/wasm.scm (wasm32-wasi-clang-runtime): New variable. [...] > +(define-public wasm32-wasi-clang-runtime > + (package (inherit clang-runtime-16) This reminds me that this should be documented, but when creating variants (packages issued from the same source but with different build flags, say), you must use package/inherit for the grafts machinery to work correctly. > + (native-inputs > + (list clang-16 > + wasi-libc)) I'd format these on one line, like you did below, since there are less than 5 and it fits. > + (inputs (list llvm-16)) > + (arguments > + (list > + #:build-type "Release" > + #:tests? #f Need an explanatory comment, e.g.: ;no test suite > + ;; Stripping binaries breaks wasm linking, resulting in the following > + ;; error: "archive has no index; run ranlib to add one". > + #:strip-binaries? #f > + #:configure-flags > + #~(list "-DCMAKE_C_COMPILER=clang" > + "-DCMAKE_C_COMPILER_TARGET=wasm32-wasi" > + (string-append > + "-DCMAKE_SYSROOT=" #$wasi-libc "/wasm32-wasi") > + (string-append > + "-DCMAKE_C_FLAGS=-I " #$wasi-libc "/wasm32-wasi/include") As Z572 mentioned, this shouldn't reference the packages directly, to be input-rewrite friendly.
Hi, Ian Eure <ian@retrospec.tv> writes: [...] > +(define-public wasm32-wasi-clang-runtime > + (package (inherit clang-runtime-16) I forgot the most important bit: inheritance cannot happen between different modules, as it uses direct (non-delayed nor thunked) references to the package objects and would introduce module circular dependencies, which are surprising and not fun to hunt down. See (info "(guix) Cyclic Module Dependencies") for the explanation/guidelines.
diff --git a/gnu/packages/wasm.scm b/gnu/packages/wasm.scm index 060e1e420f..53ea31f4a7 100644 --- a/gnu/packages/wasm.scm +++ b/gnu/packages/wasm.scm @@ -76,3 +76,33 @@ (define-public wasi-libc license:bsd-2 ;; For wasi-libc and musl-libc. license:expat)))) + +(define-public wasm32-wasi-clang-runtime + (package (inherit clang-runtime-16) + (native-inputs + (list clang-16 + wasi-libc)) + (inputs (list llvm-16)) + (arguments + (list + #:build-type "Release" + #:tests? #f + ;; Stripping binaries breaks wasm linking, resulting in the following + ;; error: "archive has no index; run ranlib to add one". + #:strip-binaries? #f + #:configure-flags + #~(list "-DCMAKE_C_COMPILER=clang" + "-DCMAKE_C_COMPILER_TARGET=wasm32-wasi" + (string-append + "-DCMAKE_SYSROOT=" #$wasi-libc "/wasm32-wasi") + (string-append + "-DCMAKE_C_FLAGS=-I " #$wasi-libc "/wasm32-wasi/include") + + "-DCOMPILER_RT_OS_DIR=wasi" + + "-DCOMPILER_RT_BAREMETAL_BUILD=On" + "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=On" + + ;; WASM only needs libclang_rt.builtins-wasm32.a from + ;; compiler-rt. + "../source/compiler-rt/lib/builtins")))))