From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id sKyRKmQ/cl/eMwAA0tVLHw (envelope-from ) for ; Mon, 28 Sep 2020 19:54:12 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 4GdLJmQ/cl/nLwAAbx9fmQ (envelope-from ) for ; Mon, 28 Sep 2020 19:54:12 +0000 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 DC7159403D2 for ; Mon, 28 Sep 2020 19:54:11 +0000 (UTC) Received: from localhost ([::1]:48618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMzDu-0002Af-8r for larch@yhetil.org; Mon, 28 Sep 2020 15:54:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMzDm-0002A5-Qc for guix-patches@gnu.org; Mon, 28 Sep 2020 15:54:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:42520) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kMzDm-0004wK-GT for guix-patches@gnu.org; Mon, 28 Sep 2020 15:54:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kMzDm-0002r0-GJ for guix-patches@gnu.org; Mon, 28 Sep 2020 15:54:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43679] [PATCH 0/5] Add '--with-toolchain' package transformation option Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 28 Sep 2020 19:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 43679 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43679@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.160132280610922 (code B ref -1); Mon, 28 Sep 2020 19:54:02 +0000 Received: (at submit) by debbugs.gnu.org; 28 Sep 2020 19:53:26 +0000 Received: from localhost ([127.0.0.1]:54066 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMzDB-0002q6-O6 for submit@debbugs.gnu.org; Mon, 28 Sep 2020 15:53:25 -0400 Received: from lists.gnu.org ([209.51.188.17]:43158) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMzD9-0002py-FX for submit@debbugs.gnu.org; Mon, 28 Sep 2020 15:53:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMzD9-00022S-6f for guix-patches@gnu.org; Mon, 28 Sep 2020 15:53:23 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:51101) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMzD7-0004rn-SZ; Mon, 28 Sep 2020 15:53:21 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=43764 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kMzD6-0002Fm-Jd; Mon, 28 Sep 2020 15:53:21 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Mon, 28 Sep 2020 21:53:05 +0200 Message-Id: <20200928195305.30096-1-ludo@gnu.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) 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" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -0.51 X-TUID: nHG2du7jh63x From: Ludovic Courtès Hello! This patch series adds the ‘--with-toolchain’ option. I’ve tested it with gcc-toolchain@10 and clang-toolchain, and I can say it works as advertised. :-) One thing I wasn’t entirely sure about: ‘--with-toolchain’ changes the toolchain of the specified package, not that of its dependents. This assumes that the toolchains all follow the same ABI. This is the case for C, apparently, maybe not for C++. Should it instead change to toolchain of the package’s dependents as well? Something like: guix build guile --with-toolchain=guile@3.0.4=clang-toolchain generates working code. Another issue is that since we use ‘package-input-rewriting/spec’, we can’t change the toolchain of core packages like Guile or Perl without rebuilding the world. For example, if we omit “@3.0.4” in the example above, we rebuild a “guile” package deep down and everything that follows (aka. “the world”). Another option I considered was to graft the package that ‘--with-toolchain’ targets instead of rebuilding its dependents. Again that’d only work if the resulting binaries are ABI-compatible, but maybe that’s a reasonable assumption. It would definitely save build time. Should it be grafted, or should there be a separate option to do that? Thoughts? Last, when doing ‘--with-toolchain=foo=gcc-toolchain’, I noticed that ‘foo’ would keep a reference to ‘gcc-toolchain’ for some obscure reasons: --8<---------------cut here---------------start------------->8--- $ ./pre-inst-env guix build hello --with-toolchain=hello=gcc-toolchain /gnu/store/qi7pqqsxhbwmy75hl43j7l0aw1xr7r42-hello-2.10 $ grep -r $(guix build gcc-toolchain | head -2 |tail -1) /gnu/store/qi7pqqsxhbwmy75hl43j7l0aw1xr7r42-hello-2.10 Duuma dosiero /gnu/store/qi7pqqsxhbwmy75hl43j7l0aw1xr7r42-hello-2.10/bin/hello kongruas $ strings /gnu/store/qi7pqqsxhbwmy75hl43j7l0aw1xr7r42-hello-2.10/bin/hello | grep $(guix build gcc-toolchain | head -2 |tail -1) /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib:/gnu/store/qj38f3vi4q1d7z30hkpaxyajv49rwamb-gcc-10.2.0-lib/lib:/gnu/store/qj38f3vi4q1d7z30hkpaxyajv49rwamb-gcc-10.2.0-lib/lib/gcc/x86_64-unknown-linux-gnu/10.2.0/../../..:/gnu/store/pknm43xsza6nlc7bn27djip8fis92akd-gcc-toolchain-10.2.0/lib --8<---------------cut here---------------end--------------->8--- Not a showstopper but would be nice to address. Feedback welcome! Ludo’. Ludovic Courtès (5): gnu: gcc-toolchain: Add 'GUIX_LOCPATH' to the search paths. gnu: clang-toolchain: Add 'GUIX_LOCPATH' to the search paths. gnu: clang-toolchain: Create 'cc' and 'c++' symlinks. packages: Add 'package-with-toolchain'. guix build: Add '--with-toolchain'. doc/guix.texi | 61 +++++++++++++++++++++++++++++++++++ gnu/packages/commencement.scm | 8 +++-- gnu/packages/llvm.scm | 12 ++++++- guix/build-system.scm | 35 ++++++++++++++++++-- guix/packages.scm | 9 ++++++ guix/scripts/build.scm | 40 +++++++++++++++++++++++ tests/packages.scm | 20 ++++++++++++ tests/scripts-build.scm | 30 +++++++++++++++++ 8 files changed, 210 insertions(+), 5 deletions(-) -- 2.28.0