From patchwork Wed May 1 21:39:32 2024 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: 26811 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 6F66B27BBEA; Wed, 1 May 2024 22:41:25 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable 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 56A0527BBE2 for ; Wed, 1 May 2024 22:41:20 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2Hgx-0008H8-EU; Wed, 01 May 2024 17:40:43 -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 ) id 1s2Hgv-0008GZ-Fn for guix-patches@gnu.org; Wed, 01 May 2024 17:40:41 -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 ) id 1s2Hgv-0001gv-7z for guix-patches@gnu.org; Wed, 01 May 2024 17:40:41 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s2HhG-0001Ej-Jy for guix-patches@gnu.org; Wed, 01 May 2024 17:41:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70492] bug#66866: Grafting breaks cross-compilation Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 01 May 2024 21:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70492 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: dan Cc: David Elsing , dev@jpoiret.xyz, Philip McGrath , Mathieu Othacehe , efraim@flashner.co.il, 66866@debbugs.gnu.org, 70492@debbugs.gnu.org, janneke@gnu.org Received: via spool by 70492-submit@debbugs.gnu.org id=B70492.17145996084690 (code B ref 70492); Wed, 01 May 2024 21:41:02 +0000 Received: (at 70492) by debbugs.gnu.org; 1 May 2024 21:40:08 +0000 Received: from localhost ([127.0.0.1]:39597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s2HgN-0001DZ-Hp for submit@debbugs.gnu.org; Wed, 01 May 2024 17:40:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53606) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s2HgK-0001D2-UZ; Wed, 01 May 2024 17:40:06 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s2Hfs-0001IY-Ky; Wed, 01 May 2024 17:39:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=PKTJuTUWxkH1yaMMlZ+oMbsulqQ7RHSARVY7zE5+BHQ=; b=dTixssOHGGxuezOc38/1 Dz8N/Jgb5ZzwZ9DpXtVZmQcAFnV9pAXMEelzxCV4ZrJjCtcKJAhD8zYG9uL7sKGJ+/DepQ9/FfrD1 ++8A9YwZkdIXMxHGf0f8mQ8e7iYDueSP8hpt3olrUOQeRNC52VDibw293AkktLsdhurwWVVPx7ENe 757FT6oLkq6jWMV+7SmboAg7LbXZ2gNeXs44GKHnE5vehOKJAaaPAitKcKI3DkvxOvjhveWNixyNU yzUyD2MXMUixhd4zErDy+wqCRm0dgWuibiFCuv0Gokp1LkvGcpmqmB/CF+LTmfnwClgJRKZ/CcV2t l+VEUa0kpPLBmw==; From: Ludovic =?utf-8?q?Court=C3=A8s?= In-Reply-To: <87frwn308k.fsf@dan.games> (dan's message of "Tue, 19 Mar 2024 01:30:31 +0800") References: <87ttnh5b4g.fsf@gnu.org> <86h6ien6bg.fsf@posteo.net> <87frwn308k.fsf@dan.games> Date: Wed, 01 May 2024 23:39:32 +0200 Message-ID: <8734r143fv.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Hi, dan skribis: > I spent some time digging into the rabbit hole. After changing > the lower function of the copy-build-system to look more like the > lower function of the gnu-build-system, I'm able to cross compile > alsa-lib without the --no-grafts flag. The changes I made are > like: > > diff --git a/guix/build-system/copy.scm > b/guix/build-system/copy.scm > index d58931b33c..74304b4bfb 100644 > --- a/guix/build-system/copy.scm > +++ b/guix/build-system/copy.scm > @@ -66,13 +66,13 @@ (define* (lower name > (bag > (name name) > (system system) > - (host-inputs `(,@(if source > + (build-inputs `(,@(if source > `(("source" ,source)) > '()) > - ,@inputs > + ,@native-inputs > ;; Keep the standard inputs of > 'gnu-build-system'. > ,@(standard-packages))) > - (build-inputs native-inputs) > + (host-inputs inputs) > (outputs outputs) > (build copy-build) > (arguments (strip-keyword-arguments private-keywords > arguments)))) > > Can we put everything inside build-inputs? From my understanding, > copy-build-system shouldn't care about cross-compilation at all. Intuitively, if ‘copy-build-system’ is about copying architecture-independent files, then it should do the same thing whether or not we are cross-compiling. However, users can and do add phases whose result is architecture-dependent. Small sample: • ‘desec-certbot-hook’ captures a reference to curl, so it would get the wrong one when cross-compiling if we assumed build-inputs = host-inputs. • ‘chez-scheme-for-racket-bootstrap-bootfiles’ builds stuff when cross-compiling. Philip, could you explain the intent and what you expect here? So it would seem we can’t just assume everything is a native input like https://issues.guix.gnu.org/70492 does. Now, as David and you found out, the use of inputs in build-system/copy.scm:lower is bogus. It seems that it can be fixed by following the intended definition of build/host inputs, as David suggested: But wait! That’s all theoretical because the bag always has (target #f) and ‘copy-build’ bundles build and host inputs together, as if doing a native build. So it seems like https://issues.guix.gnu.org/70492 (putting everything in ‘build-inputs’) is OK, after all. But still, there seem to be some expectation that ‘copy-build-system’ can support cross-compilation for real, so maybe we should add a ‘copy-cross-build’ procedure in addition to the patch above. Thoughts? Ludo’. diff --git a/guix/build-system/copy.scm b/guix/build-system/copy.scm index d58931b33c2..cf0214320bf 100644 --- a/guix/build-system/copy.scm +++ b/guix/build-system/copy.scm @@ -66,13 +66,13 @@ (define* (lower name (bag (name name) (system system) - (host-inputs `(,@(if source + (build-inputs `(,@(if source `(("source" ,source)) '()) - ,@inputs - ;; Keep the standard inputs of 'gnu-build-system'. - ,@(standard-packages))) - (build-inputs native-inputs) + ,@native-inputs + ;; Keep the standard inputs of 'gnu-build-system'. + ,@(standard-packages))) + (host-inputs inputs) (outputs outputs) (build copy-build) (arguments (strip-keyword-arguments private-keywords arguments))))