From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 8K8rIGZ2zmMXOgEAbAwnHQ (envelope-from ) for ; Mon, 23 Jan 2023 12:58:30 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id IBsEIGZ2zmOjjQAAauVa8A (envelope-from ) for ; Mon, 23 Jan 2023 12:58:30 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 44E5CB8F1 for ; Mon, 23 Jan 2023 12:58:30 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJvSe-0007yO-Tx; Mon, 23 Jan 2023 06:58:05 -0500 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 ) id 1pJvSd-0007xy-0L for guix-patches@gnu.org; Mon, 23 Jan 2023 06:58:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJvSc-00086S-OO for guix-patches@gnu.org; Mon, 23 Jan 2023 06:58:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pJvSc-00020r-7E for guix-patches@gnu.org; Mon, 23 Jan 2023 06:58:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60934] [PATCH v2 1/2] gnu: Add llvm-for-mesa. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 23 Jan 2023 11:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60934 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: John Kehayias , 60934@debbugs.gnu.org Received: via spool by 60934-submit@debbugs.gnu.org id=B60934.16744750627704 (code B ref 60934); Mon, 23 Jan 2023 11:58:02 +0000 Received: (at 60934) by debbugs.gnu.org; 23 Jan 2023 11:57:42 +0000 Received: from localhost ([127.0.0.1]:53490 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJvSH-00020C-Rk for submit@debbugs.gnu.org; Mon, 23 Jan 2023 06:57:42 -0500 Received: from mail-ej1-f43.google.com ([209.85.218.43]:38455) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJvSD-0001zp-00 for 60934@debbugs.gnu.org; Mon, 23 Jan 2023 06:57:40 -0500 Received: by mail-ej1-f43.google.com with SMTP id mg12so29790709ejc.5 for <60934@debbugs.gnu.org>; Mon, 23 Jan 2023 03:57:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:sender:from:to :cc:subject:date:message-id:reply-to; bh=sJIOnMubl+eGRkUxVK0hsoivAT+lAnHXfh5dA2wkLDU=; b=OkyZ2SQgk8JLwoQMyqQH6bZugXTyZ9Fp86/2FhTvL3+sAcUHTHVuLwlsxXV89ks5hM R7/NcMFmgxiaXi1N8LzKzYu2r6D35B6oGcPlNpykfclVx+f1ao9JhYKWMAZL5BlwTpmS CZdph97E+cq0dxlwcWPRw4ri67Ntr9CT5WWtOreTO6LD3uy00Y2VtCW9SGNR3OJY845J AtnqK3AA3EaJJSE2hmUk3BXU+3jsBM5/2CkwqqVLwwbU5Vu+FbqT18xfB4DwXlRUvQtM VkSItPngOujlM/0xpo8VjLvTOMnEgO8hHXX7Nj6GdB/0FoiFs2d5mBpCyqXj1X5f+cDI ptrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sJIOnMubl+eGRkUxVK0hsoivAT+lAnHXfh5dA2wkLDU=; b=IHZixvFJSwIAyIz1OIXkjdK7uv+nYJeHlweydT/V/JHRdGGSS9g9iosZ+Sp9Cai95a 6KxXU1ghlpR23q0YORBTLJDGuiGLNi6Ku9CnXCqkwgTM0xjzN8A3t20+QLsGv7rjDrDV yuU7gf9+fiyO1DP96uXvuEAT6WZlr8LgHEw1WflKNZ7D6CE135oh5SZQoyxoeKg3W4XC lqbLDqy+TzHm6Agbdmk1zx4lTqy3q1jNq5TwGwjUaVnHC2qFt37VSYnhaGGBFUqOnw3/ XhmCvfvLyji4Hk7yJguQOTQDZpn5TPwnxGlX+LUJDZJV9w7V3UD4EZGIzS35dCjvo46o 76QQ== X-Gm-Message-State: AFqh2kqAag2QJUgz6bMBSyWPKndwl4w2er+hYlOHpp4coWDWa0+yKrKg DinWgN8Cass7QJjhSEBpND4= X-Google-Smtp-Source: AMrXdXucGtzQrW9GqJXWKuutYtqHgsY62u7MOF/eVmX7ujoPGFfCHcRBeLJ5Icngs8efaTzc0TFyxQ== X-Received: by 2002:a17:907:c911:b0:870:5bf4:a3b1 with SMTP id ui17-20020a170907c91100b008705bf4a3b1mr22153823ejc.33.1674475051066; Mon, 23 Jan 2023 03:57:31 -0800 (PST) Received: from localhost ([141.226.15.115]) by smtp.gmail.com with ESMTPSA id n20-20020a05640205d400b0049e4458c991sm8335946edx.64.2023.01.23.03.57.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 03:57:30 -0800 (PST) Date: Mon, 23 Jan 2023 13:57:28 +0200 From: Efraim Flashner Message-ID: Mail-Followup-To: Efraim Flashner , Ludovic =?UTF-8?Q?Court=C3=A8s?= , 60934@debbugs.gnu.org, John Kehayias References: <37a43bcd770f26694343af3ae0534208dc052055.1674136307.git.efraim@flashner.co.il> <87zga935dr.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="E8NGOnIH7UslzYuA" Content-Disposition: inline In-Reply-To: <87zga935dr.fsf@gnu.org> X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1674475110; a=rsa-sha256; cv=none; b=HFy8ryg10lyRB/gyG4SP/Akv8zcD4YGn5CI/MpAITrEaZZU+IGG1KCzLkmn6fET1rK/F8k ebzmyjwPUQkkmKE0w2hWW1/uap+4tYpeWKKNggNcu9/2kKuhRoZzKPUvWBbC1SBIlFPLb1 YjlIAPn8XwNFfiT7iVmqgkYMCHyDfaFjq6VYiG40Y9JN9Fxnkd4hbkiGvXp7bvw+RaZrBX z7gn7p4MwarQvFT+kZRaPK2IVIJDEnVYykqVbfhwS/r8zPYHRWUWO1/TG+5BcapE1HHAIL iY4AhO7FntU+NbYSTnFKnkzVsVJ/AL/4OGHDcRSnP+FyxJxUDonvzmOMz33uWg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=OkyZ2SQg; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1674475110; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=sJIOnMubl+eGRkUxVK0hsoivAT+lAnHXfh5dA2wkLDU=; b=WDeJZyrddcyQzMwaL1uoVsPPkSyqDXWkb2t97GlWJpRrI6LcCWcpJHhQAc+MKNbK8oBl8v QBCEXr9Gsa7owWcY8y8D4sDgyesYOmkHPv9KVGwLg/72xKdH7UxHrsdpIgkl8uoO6SydD3 rXnrnJImGeFno8ZE39vIVDg8H19OtS6JtaugKwJ/IS5WdYUgsJ4VhsgHpsxbnasVsF7LP4 0PU3R1eEst8oSLz3pLVmF5vWzvO51HUphD2zAxZ5CHmMcoy0ULt7qPcCrg/KVEVTyzOgXl SP5qFaNYyuWm8lInkw0qBSam7L1odFT8rPIp6dnFYwZWTUqe71KZuneIx04ClQ== X-Spam-Score: -2.28 X-Migadu-Queue-Id: 44E5CB8F1 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=OkyZ2SQg; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -2.28 X-TUID: WXFbtCwVEkA6 --E8NGOnIH7UslzYuA Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 23, 2023 at 11:35:44AM +0100, Ludovic Court=C3=A8s wrote: > Hello! >=20 > Efraim Flashner skribis: >=20 > > * gnu/packages/llvm.scm (llvm-for-mesa): New variable. >=20 > Yay for reduced closures!! >=20 > > +(define-public llvm-for-mesa >=20 > Maybe add a line saying that this is a slim variant specifically > tailored for Mesa, that takes X% of the size of the default LLVM. Will do. > > + ;; Note: update the 'clang' input of mesa-opencl when bumping this. > > + (let ((base-llvm llvm-15)) > > + (package > > + (inherit base-llvm) >=20 > Add (name "llvm-for-mesa") ? I don't have a strong preference. By leaving it as 'llvm' we make it more easily substitutable by any other build of llvm since they'd have the same name length. Having it as 'llvm-for-mesa' makes it really clear what it is. > > + (arguments > > + (substitute-keyword-arguments (package-arguments base-llvm) > > + ((#:modules modules '((guix build cmake-build-system) > > + (guix build utils))) > > + `((ice-9 regex) > > + (srfi srfi-1) > > + (srfi srfi-26) > > + ,@modules)) > > + ((#:configure-flags cf ''()) > > + #~(cons* > > + ;; AMDGPU is needed by the vulkan drivers. > > + #$(string-append "-DLLVM_TARGETS_TO_BUILD=3D" > > + (system->llvm-target) ";AMDGPU") >=20 > So the result is two build only two backends, for example x86_64 and > AMDGPU, right? That's right. I tried with just (system->llvm-target) but AMDGPU was needed for the vulkan drivers. > > + ((#:phases phases '%standard-phases) > > + #~(modify-phases #$phases > > + (add-after 'install 'delete-static-libraries > > + ;; If these are just relocated then llvm-config can't = find them. > > + (lambda* (#:key outputs #:allow-other-keys) > > + (for-each delete-file > > + (find-files (string-append > > + (assoc-ref outputs "out") "/= lib") > > + "\\.a$")))) >=20 > Should we pass -DDISABLE_STATIC=3DON or whatever it=E2=80=99s called inst= ead? It turns out that static is the default, and we override it in most of the llvm packages to build shared libraries instead. If we disable the static ones too then it errors out and says it has nothing to build. > > + (add-after 'install 'build-and-install-llvm-config > > + (lambda* (#:key outputs #:allow-other-keys) >=20 > Why do we need this extra phase compared to =E2=80=98llvm=E2=80=99? Plea= se add a > comment. :-) Fair enough :) It turns out that *everyone* expects llvm-config to exist, and doing it this way allows us to only build llvm-config, not all the tools/utilities. > > + (let ((out (assoc-ref outputs "out"))) > > + (substitute* > > + "tools/llvm-config/CMakeFiles/llvm-config.dir/li= nk.txt" > > + (((string-append "/tmp/guix-build-llvm-" > > + #$(package-version base-llvm) > > + ".drv-0/build/lib")) > > + (string-append out "/lib"))) >=20 > The non-literal pattern here, and that it explicitly refers to the build > directory, is not great. >=20 > I believe you can use (string-append (getcwd) "/lib") as the pattern, > fixing the second problem. Not sure about the first one. I suppose it would be (string-append (getcwd) "/bin/lib") to fix both. I wasn't able to find a good way to get llvm-config to be configured correctly by the build system without also having it install all the utilities. When I looked in the build directory after a RUNPATH failure it had that directory as the one to link to for the libraries. > Thank you! This one's been bothering everyone for years :) --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --E8NGOnIH7UslzYuA Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmPOdiUACgkQQarn3Mo9 g1GCgRAAutaFKt4S2ASkE6N4/KgCAfXyd/3wAjyp09BmWzW2BkiQvpEVmoap+xtA XXHTCAUmLKgoiIEBST14I1nKnCPoxUctMKgf5hUHqqCjM40NhPy8D5eod1dq4LM/ qeW+sWwOIZj5y25kJQRvirO9udlthdpwxNhXI9V/+UwmNZ7P5Qc6mQ7qrrstrTb/ GAWSAQjprmhnBSpVv6M0fmvbeymD761aWxS7b3+vKAe0fa8DR/oN/y1I0XF46wlZ LbeOSScrpFP+KyCxKwhxhzDzi55S89BH6EEh+DmhCB2gwnAWrUm6J6h8um7u3G7j kPd+ONozSIhCMJsQh0J5YZJKimZd/FOUIIzxQjb6DazbdcJa90wg4uQvZyA0jzOS Cx3UACbibGLb6/CKV+iE4e1QcROLirrREYb/QukN7yOKHqUcyEkJtOvV5+7wcreN /e+pnVrrrUgOdOcxpkPn6ogQTAPqOmKIRNU6F+Eij1zIe2pkAyNty90x5am8ohNB OD+YCpJSSMJiOogDSmi4uqEucs/ghz16M4hJW6IwwWiF5wiXrzr89yyRE+8EpfSU eUjcGieCUzc1sI22xWAHBHgjFUsNGu+OcFU6UBi/Vq0+wbRaNxVAQ6Va/6bijDtR 9ZHbmt4GpJsLWMc5tpDdG5KTR919v+UZi6SFQyFf6IMF9qwL7xU= =NHOX -----END PGP SIGNATURE----- --E8NGOnIH7UslzYuA--