Subject: [bug#49565] [PATCH core-updates] gnu: bootstrap: Use %current-target-system to decide bootstrap path

From: Maxime Devos <[email-masked]>
Date: Fri, 16 Jul 2021 10:20:20 +0200

Hi,

> diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
> index 5a8028a4652c..b14dc63062e8 100644
> --- a/gnu/packages/bootstrap.scm
> +++ b/gnu/packages/bootstrap.scm
> @@ -927,7 +927,7 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \
>  (define (%bootstrap-inputs)
>    ;; The initial, pre-built inputs.  From now on, we can start building our
>    ;; own packages.
> -  (match (%current-system)
> +  (match (or (%current-target-system) (%current-system))
>      ((or "i686-linux" "x86_64-linux")
>       `(("linux-libre-headers" ,%bootstrap-linux-libre-headers)
>         ("bootstrap-mescc-tools" ,%bootstrap-mescc-tools)

This makes sense to me.
However, you may need to modify 'package-from-tarball' as well,
replacing
("tarball" ,(bootstrap-origin (source (%current-system))))))
with
("tarball" ,(bootstrap-origin (source (or (%current-target-system) (%current-system)))))))

Could you verify the architecture of the binaries in the output
of "./pre-inst-env guix build gcc-toolchain@11 --target=powerpc64le-linux-gnu",
and its references (you can use "guix gc --references /gnu/store/..." and objdump)?

Greetings,
Maxime.