all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: dan <i@dan.games>
Cc: David Elsing <david.elsing@posteo.net>,
	dev@jpoiret.xyz, Philip McGrath <philip@philipmcgrath.com>,
	Mathieu Othacehe <othacehe@gnu.org>,
	efraim@flashner.co.il, 66866@debbugs.gnu.org,
	70492@debbugs.gnu.org, janneke@gnu.org
Subject: bug#66866: Grafting breaks cross-compilation
Date: Wed, 01 May 2024 23:39:32 +0200	[thread overview]
Message-ID: <8734r143fv.fsf_-_@gnu.org> (raw)
In-Reply-To: <87frwn308k.fsf@dan.games> (dan's message of "Tue, 19 Mar 2024 01:30:31 +0800")

[-- Attachment #1: Type: text/plain, Size: 2253 bytes --]

Hi,

dan <i@dan.games> 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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 883 bytes --]

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))))

[-- Attachment #3: Type: text/plain, Size: 518 bytes --]


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’.

  parent reply	other threads:[~2024-05-01 21:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-01  1:55 bug#66866: aarch64 system cross compilation + pinebook pro image broken? Denis 'GNUtoo' Carikli
2023-11-06 17:55 ` dan
2023-11-09 11:41   ` Josselin Poiret via Bug reports for GNU Guix
2023-11-09 12:23     ` dan
2024-01-03  9:05       ` Mathieu Othacehe
2024-01-13 17:55         ` Mathieu Othacehe
2024-01-13 18:41           ` Mathieu Othacehe
2024-02-11 19:34             ` David Elsing
2024-03-18 17:30               ` dan
2024-04-10  6:44                 ` dan
2024-04-10 20:49                   ` David Elsing
2024-04-11  4:59                     ` dan
2024-05-01 21:39                 ` Ludovic Courtès [this message]
2024-05-12 15:39                   ` [bug#70492] bug#66866: Grafting breaks cross-compilation David Elsing
2023-12-31 13:23 ` bug#66866: aarch64 system cross compilation + pinebook pro image broken? Lars Rustand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8734r143fv.fsf_-_@gnu.org \
    --to=ludo@gnu.org \
    --cc=66866@debbugs.gnu.org \
    --cc=70492@debbugs.gnu.org \
    --cc=david.elsing@posteo.net \
    --cc=dev@jpoiret.xyz \
    --cc=efraim@flashner.co.il \
    --cc=i@dan.games \
    --cc=janneke@gnu.org \
    --cc=othacehe@gnu.org \
    --cc=philip@philipmcgrath.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.