From patchwork Mon Sep 28 19:53:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 24365 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 123DB27BBE8; Mon, 28 Sep 2020 20:54:11 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 599EA27BBE9 for ; Mon, 28 Sep 2020 20:54:10 +0100 (BST) Received: from localhost ([::1]:48618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMzDt-0002Af-Di for patchwork@mira.cbaines.net; Mon, 28 Sep 2020 15:54:09 -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 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches 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(-)