Subject: [bug#49565] [PATCH] gnu: glibc-headers-mesboot: Use %build-inputs in setenv phase

From: Ludovic Courtès <[email-masked]>
Date: Thu, 22 Jul 2021 00:01:07 +0200

Hi!

Thiago Jung Bauermann <[email-masked]> skribis:

> $ ./pre-inst-env guix build --target=powerpc64le-linux-gnu gcc-toolchain@11
> substitute: atualizando substitutos de "https://ci.guix.gnu.org"... 100.0%
> substitute: atualizando substitutos de "https://bordeaux.guix.gnu.org"... 100.0%
> The following derivations will be built:
>    /gnu/store/8p847f47i8b7si24ybcah8936i698v0h-gcc-toolchain-11.1.0.drv
>    /gnu/store/2qq0qdrkz6920gyn3xl4ppjqiijf8qh2-ld-wrapper-0.drv
>    /gnu/store/59v10rbcl25bcbvgh1xip2k4b8dfrs8s-libatomic-ops-7.6.10.drv
>    /gnu/store/2vv32wdv72734d54r85ahlxzddc37gdb-tar-boot0-1.34.drv
>    /gnu/store/5h6sjkz0cw5yn77lf2x5i05wina2c2s1-sed-mesboot-4.0.6.drv
>    /gnu/store/9baisja0i8z81cpx9bs8dp6bgwbf5hg2-gzip-mesboot-1.2.4.drv
>    /gnu/store/aw84y6dbh7av5077dp9cgj3acqwychvs-xz-mesboot-5.0.0.drv
>    /gnu/store/d9f9mqjpb0n8fplzplayc5fz9pwvka7f-grep-mesboot-2.0.drv

I think you hit a corner with ‘gcc-toolchain’.  The packages in
commencement.scm (*-boot0, *-mesboot, etc.) should never be
cross-compiled; they’re not meant to.  If you find a command that ends
up trying to cross-compile them, it means there’s a problem.

What you want in this case is:

  ./pre-inst-env guix build -e '(@ (gnu packages gcc) gcc-11)' \
     --target=powerpc64le-linux-gnu -n

That is going to build the right thing.

Why is ‘gcc-toolchain’ a special case?  Precisely because it pulls in
things from commencement.scm: ‘binutils-final’, ‘glibc-final’, etc.

And why does it pull these ‘-final’ variants instead of the ‘binutils’,
‘glibc’, etc. you ask?  :-)  That’s to save space; that way, you don’t
end up downloading/building another toolchain when you run
‘guix install gcc-toolchain’.

I hope this clarifies things a bit!

Ludo’.