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

From: Thiago Jung Bauermann <[email-masked]>
Date: Wed, 21 Jul 2021 21:32:16 -0300

Hi Ludo’,

Em quarta-feira, 21 de julho de 2021, às 19:01:07 -03, Ludovic Courtès
escreveu:
> 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.

My doubt was whether they were being cross-compiled, or Guix was building
them natively as an intermediary step in the path to obtain a
cross-toolchain.

This patch:

https://issues.guix.gnu.org/49565#11

allows gcc-toolchain@11 to be cross-compiled without going through mesboot
packages – or it would if bug 49600 didn’t get in the way. Do you think
it is correct?

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

Nice! I should have thought of it.

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

It does! Thank you very much for these clarifications. The pieces are still
falling into place in my mind.

-- 
Thanks,
Thiago