Grafting breaks cross-compilation

  • Open
  • quality assurance status badge
Details
8 participants
  • Denis 'GNUtoo' Carikli
  • David Elsing
  • Josselin Poiret
  • dan
  • Ludovic Courtès
  • Mathieu Othacehe
  • Mathieu Othacehe
  • Lars Rustand
Owner
unassigned
Submitted by
Denis 'GNUtoo' Carikli
Severity
important
D
D
Denis 'GNUtoo' Carikli wrote on 1 Nov 2023 02:55
aarch64 system cross compilation + pinebook pro image broken?
(address . bug-guix@gnu.org)
20231101025517.5cce4d7f@primary_laptop
Hi,

With:
Toggle quote (7 lines)
> $ guix describe
> Generation 311 nov. 01 2023 00:03:34 (current)
> guix 938a47c
> repository URL: https://git.savannah.gnu.org/git/guix.git
> branch: master
> commit: 938a47c86d7bea785f33f42834c5c1f3dfa594b0

And the following minimalist system configuration:
Toggle quote (17 lines)
> ;;; Copyright © 2023 Denis 'GNUtoo' Carikli. SPDX-License-Identifier:
> GPL-3.0+ (use-modules (gnu bootloader)
> (gnu bootloader u-boot)
> (gnu system file-systems)
> (gnu packages linux)
> (guix gexp))
> (operating-system
> (host-name "g")
> (bootloader (bootloader-configuration
> (bootloader u-boot-rockpro64-rk3399-bootloader)
> (targets '("/dev/mmcblk2"))))
> (kernel linux-libre-arm64-generic)
> (file-systems (cons (file-system (mount-point "/")
> (device "/dev/vda1")
> (type "ext4"))
> %base-file-systems)))

that I built with:
Toggle quote (2 lines)
> guix system build --target=aarch64-linux-gnu noconfig.scm

I end up with:
Toggle quote (35 lines)
> [...]
> checking build system type... x86_64-unknown-linux-gnu
> checking host system type... Invalid configuration
> `aarch64-linux-gnu': machine `aarch64' not recognized configure:
> error:
> /gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash
> ./config.sub aarch64-linux-gnu failed error: in phase 'configure':
> uncaught exception: srfi-34 #<condition &invoke-error [program:
> "/gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash"
> arguments: ("./configure" "CC_FOR_BUILD=gcc"
> "CONFIG_SHELL=/gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash"
> "SHELL=/gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash"
> "--prefix=/gnu/store/mn43k8aldd7h9jcx8q5ryij29kdqriz0-gawk-mesboot-3.1.8"
> "--enable-fast-install" "--build=x86_64-unknown-linux-gnu"
> "--host=aarch64-linux-gnu" "ac_cv_func_connect=no") exit-status: 1
> term-signal: #f stop-signal: #f] 1700400> phase `configure' failed
> after 115.3 seconds command
> "/gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash"
> "./configure" "CC_FOR_BUILD=gcc"
> "CONFIG_SHELL=/gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash"
> "SHELL=/gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash"
> "--prefix=/gnu/store/mn43k8aldd7h9jcx8q5ryij29kdqriz0-gawk-mesboot-3.1.8"
> "--enable-fast-install" "--build=x86_64-unknown-linux-gnu"
> "--host=aarch64-linux-gnu" "ac_cv_func_connect=no" failed with status
> 1 builder for
> `/gnu/store/9xwp6pi7ssi9jhhj50dd1apryidcz2hk-gawk-mesboot-3.1.8.drv'
> failed with exit code 1 build of
> /gnu/store/9xwp6pi7ssi9jhhj50dd1apryidcz2hk-gawk-mesboot-3.1.8.drv
> failed View build log at
> '/var/log/guix/drvs/9x/wp6pi7ssi9jhhj50dd1apryidcz2hk-gawk-mesboot-3.1.8.drv.gz'.
> cannot build derivation
> `/gnu/store/jgd1kl2zavkxsvxa875r8lpndq292vgb-glibc-2.35.drv': 1
> dependencies couldn't be built guix system: error: build of
> `/gnu/store/jgd1kl2zavkxsvxa875r8lpndq292vgb-glibc-2.35.drv' failed

I've tried to bisect that with:
$ guix time-machine --commit=<commit> -- \
system build--target=aarch64-linux-gnu noconfig.scm
but strangely I failed to find some working commit, so I end up not
being able to bisect.

As I understand the Pinebook pro image is also cross compiled, so
normally that should fail in the same way. But here something is
really strange as well:
- The CI says everything is ok here:
- The download image doesn't exist but return '{"error":"Could not find
the requested build product."}' instead.

That correspond to the commit e6af40d7b46b5c9e397a38c62c885fb42ccd9d26 .

So if I use:
Toggle quote (4 lines)
> ;; Adapted from Guix manual, GFDL 1.3 (+?)
> (use-modules (gnu system images pine64))
> (operating-system (inherit pine64-barebones-os))

with:
$ guix time-machine \
--commit=e6af40d7b46b5c9e397a38c62c885fb42ccd9d26 \
-- \
system build --target=aarch64-linux-gnu pine64.scm

I still end up with:
Toggle quote (34 lines)
> checking build system type... x86_64-unknown-linux-gnu
> checking host system type... Invalid configuration
> `aarch64-linux-gnu': machine `aarch64' not recognized configure:
> error:
> /gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash
> ./config.sub aarch64-linux-gnu failed error: in phase 'configure':
> uncaught exception: srfi-34 #<condition &invoke-error [program:
> "/gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash"
> arguments: ("./configure" "CC_FOR_BUILD=gcc"
> "CONFIG_SHELL=/gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash"
> "SHELL=/gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash"
> "--prefix=/gnu/store/mn43k8aldd7h9jcx8q5ryij29kdqriz0-gawk-mesboot-3.1.8"
> "--enable-fast-install" "--build=x86_64-unknown-linux-gnu"
> "--host=aarch64-linux-gnu" "ac_cv_func_connect=no") exit-status: 1
> term-signal: #f stop-signal: #f] 170f400> phase `configure' failed
> after 209.2 seconds command
> "/gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash"
> "./configure" "CC_FOR_BUILD=gcc"
> "CONFIG_SHELL=/gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash"
> "SHELL=/gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash"
> "--prefix=/gnu/store/mn43k8aldd7h9jcx8q5ryij29kdqriz0-gawk-mesboot-3.1.8"
> "--enable-fast-install" "--build=x86_64-unknown-linux-gnu"
> "--host=aarch64-linux-gnu" "ac_cv_func_connect=no" failed with status
> 1 builder for
> `/gnu/store/9xwp6pi7ssi9jhhj50dd1apryidcz2hk-gawk-mesboot-3.1.8.drv'
> failed with exit code 1 build of
> /gnu/store/9xwp6pi7ssi9jhhj50dd1apryidcz2hk-gawk-mesboot-3.1.8.drv
> failed View build log at
> '/var/log/guix/drvs/9x/wp6pi7ssi9jhhj50dd1apryidcz2hk-gawk-mesboot-3.1.8.drv.gz'.
> cannot build derivation
> `/gnu/store/jgd1kl2zavkxsvxa875r8lpndq292vgb-glibc-2.35.drv': 1
> dependencies couldn't be built guix system: error: build of
> `/gnu/store/jgd1kl2zavkxsvxa875r8lpndq292vgb-glibc-2.35.drv' failed

Denis.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEeC+d2+Nrp/PU3kkGX138wUF34mMFAmVBsAUACgkQX138wUF3
4mM5uxAAhLoBxaB8TzekmwIP8u47E59nmuygsN4dSHfqxMMSSZGu8dZvDBskSLvl
vFcOS5CAV2QLFtQULYpvuAHIDnzejjs7jAk1NNpTdUIh/HWGpm8Yx95vHRXxXBHk
5I39SX3i3ItbEa8dbjD8CtDF1B7H5aHo/hWq9z9LeEhH9alTMAD0PKGDcEW10V/Z
3gh547XcUiP5Atss9XyFmuo3jX3WxZeDV3dapmQ+mUfU7Esd5VX6/42c1WVNnmiq
zoCIhK7GGYpJxGoKp1rxXjaJccYDh9VZhpQdQqmPtRbhZrEGrVyKGjW0tWR+aksi
AJ/6YT2ZLBGMcAQL5fYXNo6cBQLadJDTmWoyxm3BLi6a1wBcYiK1oKpzQzzi/elI
obi1KlPoaAf5pJgR44/QplEpJwNsKx83j6Z9TE/8nPvQKRzerHK/m7UMgJpB3hEN
VebPPUkbE/Vsq9MrFeuW/TvzGpGbOUn7Jonm35K7MJiUSpOq4hsqjWy0pWrJECip
kz2JnA2eiLiFTTY52EKRNBql9mE7crMtlvIfNNH8sV24GaYQVTsZZA+mqlqGCphE
hOBw9VIU4oZ+w2HBf8CHeEdQK4QB93LFUvREExGEyobreYHhjYlVP5qqWGJfiv6k
x6sL0DjcbJLAQpFn5N5aF0uYnIOUgUZdBRmIC8ULGzAKRGi69aI=
=HWRm
-----END PGP SIGNATURE-----


D
J
J
Josselin Poiret wrote on 9 Nov 2023 12:41
Re: bug#66866: aarch64 system cross compilation + pinebook pro image broken?
874jhv6tn7.fsf@jpoiret.xyz
Hi dan,

dan <i@dan.games> writes:

Toggle quote (3 lines)
> with git bisect i found after this commit the cross-compilation
> couldn't work anymore:

Could you post some more details about what you mean by "couldn't work"?
What exactly is failing, and with what logs?

Best,
--
Josselin Poiret
-----BEGIN PGP SIGNATURE-----

iQHEBAEBCgAuFiEEOSSM2EHGPMM23K8vUF5AuRYXGooFAmVMxWwQHGRldkBqcG9p
cmV0Lnh5egAKCRBQXkC5Fhcaity6C/sHaBPm5TI/MieR4Zx/u1NcIWwTzO6VRo1f
xJrX+VEYX4KDvakt83L2JVTHnndlH8j9i/UL/lrtuQmpC3dz6KclSycW/+C1GCfI
Y/JloUmHEmeeyWWw7xX7MK8qUTkGg3cDsC18GlrTsykmruF+5jvTLJOUjhwfSYHQ
sL2gSc9Mv5+Ov6MqbsLOXlF4XuKEVY1TmmqeJqX2YzY5BiHKCTD6S59G7UYWvegP
xu7kC5rB54sxEr0sPVF1D4wXQkzF3AYOwFN+X2GpqCbzGWbPdNcWABI/NKx7V7oP
/5vaeVakONWk2v5/4G0jF8NSObzf64SS5bEkU70W/ywoTvGnXPIjY2ZV3yWHrOQg
6mNhuBJUZLQhBxSuVBk6gCVIXBNkQNvEmUxYiWoIvaHOhR7m5F67JwMUILDHENqN
CmnTxMqzkzuQXJiYfN1GXxeyR0sBM89LD+0xJMejTJcDFCVmU7TRmcQ8QdfnereV
vEhzQ2ZdOpF2qRJNtzlG0TbKRfsJwpA=
=PZI6
-----END PGP SIGNATURE-----

D
(name . Josselin Poiret)(address . dev@jpoiret.xyz)(address . 66866@debbugs.gnu.org)
87a5rn6qz7.fsf@dan.games
Hi Josselin,

Josselin Poiret <dev@jpoiret.xyz> writes:

Toggle quote (4 lines)
> Could you post some more details about what you mean by
> "couldn't work"?
> What exactly is failing, and with what logs?

I was testing it with a cloned guix repo on my disk, opening a
shell with "guix shell -D guix git".

when checkout to the following commit:
Toggle quote (6 lines)
> $ ./pre-inst-env guix describe
> Git checkout:
> repository: /home/dan/workspace/guix/guix/
> branch: HEAD
> commit: 1328c4cca531318e3ed90c6aecb522a5b22a4bcc

i run "./pre-inst-env guix system build
gnu/system/images/pine64.scm --target=aarch64-linux-gnu -n" would
get the following result:
Toggle quote (31 lines)
> $ ./pre-inst-env guix system build gnu/system/images/pine64.scm
> --target=aarch64-linux-gnu -n
> The following derivations would be built:
> /gnu/store/jgd1kl2zavkxsvxa875r8lpndq292vgb-glibc-2.35.drv
> /gnu/store/0za1m1xwpzwai1sgq5zwgyk6zg62w6a0-diffutils-boot0-3.8.drv
> /gnu/store/1mizwrvfq2f96jjwxbky0q1pbdhfr09g-grep-mesboot-3.8.drv
> /gnu/store/9xwp6pi7ssi9jhhj50dd1apryidcz2hk-gawk-mesboot-3.1.8.drv
> /gnu/store/bfh1p0wjl0jgy7yyzrl9kxxls08in0z9-glibc-mesboot-2.16.0.drv
> /gnu/store/bwx8g1wy9pc4aa5my3c8mqg0cb68hhw3-make-mesboot-3.82.drv
> /gnu/store/da5mc3xqc5rqlzc6jyvhgw2nklhcxrxn-gcc-mesboot-4.9.4.drv
> /gnu/store/f5l62q2ykp5vc9pvnw7cwp9ymkyb1m0p-tar-mesboot-1.34.drv
> /gnu/store/knnik0y9ckaiahhyrc0vrmciz92jfiaf-gcc-mesboot-wrapper-4.9.4.drv
> /gnu/store/sdz4dcdd1fnp078m4km980h3q5668w44-sed-mesboot-4.8.drv
> /gnu/store/svcq1qj4j5b784z2sykrm5nj6qsv0mly-make-boot0-4.3.drv
> /gnu/store/vljsi6fwfpxwf3bivhsv7nvrdilk0c89-xz-mesboot-5.2.8.drv
> /gnu/store/1am1zifq9lvlrx7xayzfgq10bzwyi9jz-gawk-boot0-5.2.1.drv
> /gnu/store/2fyrmqijwm1kn90iy1n339kip9c4iq7d-bzip2-boot0-1.0.8.drv
> /gnu/store/3kcikvc17a4wfh4bz13sibnbbz2ybi8j-sed-boot0-4.8.drv
> /gnu/store/879pl2y8f87r7x7p14cxg43qzwrabvhz-bash-static-5.1.16.drv
> /gnu/store/9h6w80fckq0pz6h9w7ab6si6x9arw46s-coreutils-boot0-9.1.drv
> /gnu/store/b7abpvf7w2yv8qzj9gvrbxqvys3cfvvi-binutils-cross-boot0-2.38.drv
> /gnu/store/gjln0wdfin1cd4pa5p05xpgcm18zhbpb-tar-boot0-1.34.drv
> /gnu/store/lzyaiv4rri34n3wqyr7sh7as5rm3qscy-file-boot0-5.44.drv
> /gnu/store/xkrprcjws5xjanfbyzxvyjrz59dza43l-findutils-boot0-4.9.0.drv
> /gnu/store/z9v1jii5ja9y8szrgfyq9vbainldzzrx-patch-boot0-2.7.6.drv
> /gnu/store/bansacd0mz6f0jilr2b18na7k41vyd7l-gcc-cross-boot0-wrapped-11.3.0.drv
> /gnu/store/c97avnw7ivnsf4zpz2lhpy7gnxvdyi1v-glibc-intermediate-2.35.drv
> /gnu/store/f9djhbwy9p706xzkl0r0zx5brqhlm0qd-gcc-cross-boot0-11.3.0.drv
> /gnu/store/r4ab2f6hmrd0z630c1isyyq7dd3pr3zd-libstdc++-boot0-4.9.4.drv
> /gnu/store/nq5i5b8y411hfzc5a0xcqmjiw6y2f5wq-ld-wrapper-boot0-0.drv

but with the previous commit:
Toggle quote (6 lines)
> $ ./pre-inst-env guix describe
> Git checkout:
> repository: /home/dan/workspace/guix/guix/
> branch: HEAD
> commit: f62737bfee086040fa3ecb26968f6d16f84147aa

i run the same command, would get the following result:
Toggle quote (117 lines)
> $ ./pre-inst-env guix system build gnu/system/images/pine64.scm
> --target=aarch64-linux-gnu -n
> The following derivations would be built:
> /gnu/store/cax2125wghlr5wz8hwllrz6vb3l7wd83-system.drv
> /gnu/store/1r0j7c31427lirfdrdggjk9q3jqimf2h-etc.drv
> /gnu/store/4wf34mjqdb7bnx6jfyhlyki5v14dzvvg-profile.drv
> /gnu/store/3wh899wnr71shq81lnl3kaw1rpnilvrn-linux-libre-arm64-generic-6.4.16.drv
> /gnu/store/x7c5jrsg2kv71jb5bdxf4cv107mlnf4p-linux-libre-6.4.16-guix.tar.xz.drv
> /gnu/store/gyhzn3j6iqa3yf25fv2crbkssg5b7xn5-linux-libre-6.4.16-guix.tar.xz.drv
> /gnu/store/d11phf2n76syynzmrf02va9phjmgr2d2-raw-initrd.drv
> /gnu/store/fqnahvhkabz9riaw5ffr3pnpsp1qiyj8-init.drv
> /gnu/store/0arw5hrqdvzf2ma370ki2d2sn7gij3j5-linux-modules.drv
> /gnu/store/92phv6cpskhywlwv0lqh9ssrmdbm3rls-module-import-compiled.drv
> /gnu/store/hgd43fd0b1xgfw23xmq99k75kiq94zpq-boot.drv
> /gnu/store/a5gwz9v5l5slihmws7wh9x0ic1ckjrb7-shepherd.conf.drv
> /gnu/store/0kiyxgqnjxigfcks0n494apj6wqb6ylg-shepherd-term-tty3.go.drv
> /gnu/store/hpjcgw36jypikzj4qqsb8wmlh140gy1f-shepherd-term-tty3.scm.drv
> /gnu/store/14f4h28fs49vnqvdc65xr5ddcmsh2i79-shepherd-user-file-systems.go.drv
> /gnu/store/njwv1l3hx5lcph4k0d0ld0j3cggc6c3h-shepherd-user-file-systems.scm.drv
> /gnu/store/1blrbcbd54yxzc6i57gqba3wf59icc6p-shepherd-file-system--sys-kernel-debug.go.drv
> /gnu/store/69i8aqkgqlka4f9ld1dg6bqgykc6ygpa-shepherd-file-system--sys-kernel-debug.scm.drv
> /gnu/store/1sriznlp88pvsjl7nc0pjjzbdy5ws3af-shepherd-loopback.go.drv
> /gnu/store/rrxcn31zcsnxlaq8zk9gll4iidh0ic1m-shepherd-loopback.scm.drv
> /gnu/store/v31z2xn1cppj0a1f3yiyvj644vmwndin-set-up-network.drv
> /gnu/store/y6jhmhhi82pmbdajj69bbzmy4k32pdfg-tear-down-network.drv
> /gnu/store/2kk9i32m2kb8cnz30j4bwh4mmdndppl5-shepherd-term-tty4.go.drv
> /gnu/store/k05d8mgivw164n2y4gjg2x3z7lkqdpqw-shepherd-term-tty4.scm.drv
> /gnu/store/520k2gmf1ijjb76ya5w6ygbv4liwp39k-shepherd-sysctl.go.drv
> /gnu/store/fib3qy0y43a4a93qyndqbikvqgrhfkxa-shepherd-sysctl.scm.drv
> /gnu/store/7s3s1668iaiim9dpgz1a7csff4jwc3xh-shepherd-file-system--gnu-store.go.drv
> /gnu/store/bja3yyc9w5hky3r1aq5hdnb1krn7qg4m-shepherd-file-system--gnu-store.scm.drv
> /gnu/store/8dq6wd9r3jzvqd0vr8q1glp6mhj6gjpf-shepherd-syslogd.go.drv
> /gnu/store/51srqr58bryw03yk270v9mssbfarmpp9-shepherd-syslogd.scm.drv
> /gnu/store/99q0vjfzifrfgscc8yl194c9q52fkwyq-shepherd-udev.go.drv
> /gnu/store/65df4zhha8cf26n22vyj17gsj9724474-shepherd-udev.scm.drv
> /gnu/store/bm7xbhjj5zs2xq23gnq6gnzyilxmbs07-shepherd-user-homes.go.drv
> /gnu/store/6hrjiznzhzgjj3adgkq1zwkvlyyj314m-shepherd-user-homes.scm.drv
> /gnu/store/bmsjagrlm632hv92gkrpdpjq3n229sna-shepherd-term-ttyS0.go.drv
> /gnu/store/z4s7dgif1y0yva5xqbjy34lnf7zv7gf2-shepherd-term-ttyS0.scm.drv
> /gnu/store/chwdh3w2dak4p8kgapsxd1lqp9iz62g5-shepherd-term-tty5.go.drv
> /gnu/store/s13f3l8xbyilkc0a1yqw7s49h6cq2i13-shepherd-term-tty5.scm.drv
> /gnu/store/cxagxv7w84ql14pccfjnb06856a2g9l5-shepherd-ntpd.go.drv
> /gnu/store/kivwsv987k6gk6j7p83fj3l01vyx1y7p-shepherd-ntpd.scm.drv
> /gnu/store/d3f3dmjx37v0nqbya4jsdghm6v1qrzh5-shepherd-file-system--dev-shm.go.drv
> /gnu/store/h21i7lnl53r44gihzyr0fgvddm1s6p46-shepherd-file-system--dev-shm.scm.drv
> /gnu/store/fz1rh58hxrjbbapx18rpls7bnakgzhxw-shepherd-console-font-tty5.go.drv
> /gnu/store/8mql0kq6kcjd61rwj8bls9m5mlcsq0a8-shepherd-console-font-tty5.scm.drv
> /gnu/store/gjvqi9g6yy9qci4p67kyyaam6dw61805-shepherd-console-font-tty1.go.drv
> /gnu/store/402zm6hv4lc39z0ykfsx714ib5bcv5wm-shepherd-console-font-tty1.scm.drv
> /gnu/store/hngg96ll4kf0z86nhw4ywkzv0lza583d-shepherd-root-file-system.go.drv
> /gnu/store/2li00z702m92f0li64s24fqb8976ilfw-shepherd-root-file-system.scm.drv
> /gnu/store/i2yxdpd0kkxlvsg0r6lcqh71r9j6v05i-shepherd-console-font-tty2.go.drv
> /gnu/store/h8vy9vhijsaaigfqfr72yda1fa6bx592-shepherd-console-font-tty2.scm.drv
> /gnu/store/i5l3z1nd148i4nfwqmaa8bm4aj3vg4ac-shepherd-mcron.go.drv
> /gnu/store/2mcmgdhxqxpnlw62w34fsiind9wmdkap-shepherd-mcron.scm.drv
> /gnu/store/igh05n6cl1j4mbln0pbcigvivy0b9ikg-shepherd-term-console.go.drv
> /gnu/store/hf45xs7dg95hxlvy5mgzr97b6ddc6x5k-shepherd-term-console.scm.drv
> /gnu/store/ihjlaih6s44qkbbm14f1cy5q19rr1akm-shepherd-nscd.go.drv
> /gnu/store/lp1bbipmkc9g3yql4h065i5dhgx5jrc8-shepherd-nscd.scm.drv
> /gnu/store/iisgxznxsy92wsjzrqcf6ddwmn28nx4f-shepherd-console-font-tty6.go.drv
> /gnu/store/6icw2vx5r4wh3dbsxmnh2w2503qrmqyz-shepherd-console-font-tty6.scm.drv
> /gnu/store/ij0lkffa6wdlyl7kj27s2w6zax1rvxd9-shepherd-console-font-tty4.go.drv
> /gnu/store/25g92fvbda0yrizzzw8kjadsamm26srm-shepherd-console-font-tty4.scm.drv
> /gnu/store/j9k6rmd56bdn15902liwxv48x2bbq11s-shepherd-networking.go.drv
> /gnu/store/dvv78as9zahczwah44rmi5rl4s7yg8ax-shepherd-networking.scm.drv
> /gnu/store/jk5fymc5jib7w21a7p956pbz852yalww-shepherd-term-tty6.go.drv
> /gnu/store/ngzgzpi2bz690q1nskdz2fjrsp331xlg-shepherd-term-tty6.scm.drv
> /gnu/store/jx2jppx5dhmnjcwcfxls2kg77x264hx1-shepherd-user-processes.go.drv
> /gnu/store/bp8sivwmxa3g9wzdwzpjaa4nwskiwasf-shepherd-user-processes.scm.drv
> /gnu/store/k79janpj778l510bgi37wpmxh0ha1hh2-shepherd-file-system--sys-firmware-efi-efivars.go.drv
> /gnu/store/y223il22d89isplp1bian122anyjpdx8-shepherd-file-system--sys-firmware-efi-efivars.scm.drv
> /gnu/store/mavfkif2mrzs5kl0ki991qw6bjjba0g0-shepherd-virtual-terminal.go.drv
> /gnu/store/rdqs6n095b3ik11xssxm5yxxx11pkb60-shepherd-virtual-terminal.scm.drv
> /gnu/store/n59zim15hxx6la4dlx1vnzh1yxsb0yid-shepherd-guix-daemon.go.drv
> /gnu/store/mr9c3vz52xw91f8f0vdbh4jrcq5rgmrg-shepherd-guix-daemon.scm.drv
> /gnu/store/bsg6ch3xba65vbnvzyhziy3yipdl83rb-module-import-compiled.drv
> /gnu/store/xj7d31m5al9p9s01js3wm2xzq00yw65k-module-import.drv
> /gnu/store/gh8jn7v8g6wjlv7xxd4iwb8s6lf1vi13-module-import.drv
> /gnu/store/j4jpv3fz040ib61a5gxmfnkhlmpbxjqh-module-import-compiled.drv
> /gnu/store/nbbh16s2mknyqbg2xg0iyv26rlzgvjaw-shepherd-term-tty1.go.drv
> /gnu/store/6wfg73yi16y53s4s7hcz5nxwcfxjcaz3-shepherd-term-tty1.scm.drv
> /gnu/store/nv97smi17v2karxph7srdrfpwq35rppw-shepherd-pam.go.drv
> /gnu/store/v8ff296w21accz3bvqg9jh8wdc82qvga-shepherd-pam.scm.drv
> /gnu/store/palakvjqjnj80jbyra4scfyspih1wifi-shepherd-console-font-tty3.go.drv
> /gnu/store/y005yjlik5dsixcni8msx9nbqsbipxcj-shepherd-console-font-tty3.scm.drv
> /gnu/store/rgbw62hmvkxjlgdfk3f3ry5l5pn4zh75-shepherd-file-systems.go.drv
> /gnu/store/dkh818aiaj7avqd8rp5zm9nisl1r3711-shepherd-file-systems.scm.drv
> /gnu/store/rrllmghp7q776jywrr75qhmrspg26584-shepherd-term-tty2.go.drv
> /gnu/store/897giswvipl2xhgwb9v4yz1y09ivhlhq-shepherd-term-tty2.scm.drv
> /gnu/store/sxa2xavxmcdawczwzqfrxvjxai9m9371-shepherd-host-name.go.drv
> /gnu/store/xip20gf2vd552myd42ycp2dyhai35xng-shepherd-host-name.scm.drv
> /gnu/store/y0ni7a5zjy4nqv4yfxn4bslzsj6v88pm-shepherd-file-system--dev-pts.go.drv
> /gnu/store/h7cbhd75fdav2031v155pw0a5zs52jzg-shepherd-file-system--dev-pts.scm.drv
> /gnu/store/yqcz9zidxs1kdq77zhap3zkpx3fcp0ay-shepherd-urandom-seed.go.drv
> /gnu/store/lqvhnjgzawdpnvljggvrr83hl37aadhy-shepherd-urandom-seed.scm.drv
> /gnu/store/vd1l7svckb1fq3nlmzjwbzaqp4cz0x9n-activate.scm.drv
> /gnu/store/1vgahz7srvsdzbhjnc702gl7qi60vpf4-activate-service.scm.drv
> /gnu/store/gx60xc2lrxgd1fibjcwkvi454ddhq8k8-acl.drv
> /gnu/store/8bbiy0lafccd4lzp0af57l0w3psbdzmn-module-import.drv
> /gnu/store/nb6fkdy1v30xlkd4p3xs4bwfqfg9dssb-module-import-compiled.drv
> /gnu/store/3agzzn8p3zin7vnzhhah8r6r2pgff0ds-activate-service.scm.drv
> /gnu/store/znkjpdb6x1sf6vzya7bycvpbgvvlnnmz-activate-service.scm.drv
> /gnu/store/k9y3w7adb6g3cp3flgadz4apmly0qq4r-parameters.drv
> /gnu/store/x02skzyvfwdrhff50lp0yq25ha9gr5gg-profile.drv
> The following grafts would be made:
> /gnu/store/y7lx3n5lqkp7vk6nzkhk10bigkgdf8x0-ntp-4.2.8p17.drv
> /gnu/store/aqgyf8rnhfir47cgqgh1800fcsqzvm1g-usbutils-015.drv
> /gnu/store/3bwg8pc7hd2m735sb1sl5is9ksh44l0m-python-3.10.7.drv
> /gnu/store/cv70dvs89zfqfhsah2l0ch0jx3dqx0kc-tk-8.6.12.drv
> The following profile hooks would be built:
> /gnu/store/4vg65901lji5f69d0p28zgsb9ixsa9wy-linux-module-database.drv
> /gnu/store/gm6qi78vsz56rnl69nqyqjjd2i0bn8l6-manual-database.drv
> /gnu/store/l2g2ibnrvh9r0xfjjfp3y4qygavj6z54-fonts-dir.drv
> /gnu/store/mlnqcgp644h5wbd0sj8xxnfj6ywva91j-info-dir.drv
> /gnu/store/qj73yz4kwdp30vk9524sjqr2bng8zbfj-ca-certificate-bundle.drv
> /gnu/store/wfpvk0c61qpgyd04qhqn07lh1nry7fqn-emacs-subdirs.drv

It seems like with commit
1328c4cca531318e3ed90c6aecb522a5b22a4bcc, when building the system
image, it tries to bootstrap the world? When running the previous
command without the "-n", it returns the exact same error posted
by GNUtoo, which is failed at building gawk-mesboot, which doesn't
support aarch64-linux at the moment.

Are these logs sufficient?

--
dan
L
L
Lars Rustand wrote on 31 Dec 2023 14:23
aarch64 system cross compilation + pinebook pro image broken?
(address . 66866@debbugs.gnu.org)
87wmsuxzrz.fsf@gmail.com
Hello, bumping this issue since there has been no activity for a while
and this error is still present. I get the exact same error as Denis
when building any Pine64 images. Building with --system=aarch64-linux
instead of --target=aarch64-linux-gnu works, but this is very much
slower.


This is what I get:

Toggle quote (15 lines)
> checking for string.h... (cached) yes
> checking whether NLS is requested... yes
> checking for msgfmt... no
> checking for gmsgfmt... :
> checking for xgettext... no
> checking for msgmerge... no
> checking build system type... x86_64-unknown-linux-gnu
> checking host system type... Invalid configuration `aarch64-linux-gnu': machine `aarch64' not recognized
> configure: error: /gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash ./config.sub aarch64-linux-gnu failed
> error: in phase 'configure': uncaught exception:
> srfi-34 #<condition &invoke-error [program: "/gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash" arguments: ("./configure" "CC_FOR_BUILD=gcc" "CONFIG_SHELL=/gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash" "SHELL=/gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash" "--prefix=/gnu/store/bl3aq7fnpyxq9w2a7bqa4zqgd8z88y8x-gawk-mesboot-3.1.8" "--enable-fast-install" "--build=x86_64-unknown-linux-gnu" "--host=aarch64-linux-gnu" "ac_cv_func_connect=no") exit-status: 1 term-signal: #f stop-signal: #f] 152c4c0>
> phase `configure' failed after 38.7 seconds
> command "/gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash" "./configure" "CC_FOR_BUILD=gcc" "CONFIG_SHELL=/gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash" "SHELL=/gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash" "--prefix=/gnu/store/bl3aq7fnpyxq9w2a7bqa4zqgd8z88y8x-gawk-mesboot-3.1.8" "--enable-fast-install" "--build=x86_64-unknown-linux-gnu" "--host=aarch64-linux-gnu" "ac_cv_func_connect=no" failed with status 1


Other cross-compiled images like Raspberry Pi work fine for me.
M
M
Mathieu Othacehe wrote on 3 Jan 10:05 +0100
(name . dan)(address . i@dan.games)
87o7e2zt0c.fsf@gnu.org
Hello,

I can reproduce the error by running:

Toggle snippet (3 lines)
./pre-inst-env guix system build --target=aarch64-linux-gnu gnu/system/images/pine64.scm

which cause an issue in gawk-mesboot:

Toggle snippet (4 lines)
checking host system type... Invalid configuration `aarch64-linux-gnu': machine `aarch64' not recognized
configure: error: /gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash ./config.sub aarch64-linux-gnu failed

Janneke, do you know what could have caused this regression?

Thanks,

Mathieu
M
M
Mathieu Othacehe wrote on 13 Jan 18:55 +0100
(name . dan)(address . i@dan.games)
871qal6ruc.fsf@gnu.org
Hey,

Toggle quote (10 lines)
> ./pre-inst-env guix system build --target=aarch64-linux-gnu gnu/system/images/pine64.scm
>
>
> which cause an issue in gawk-mesboot:
>
> checking host system type... Invalid configuration `aarch64-linux-gnu': machine `aarch64' not recognized
> configure: error: /gnu/store/rb75igdc6daly1mz2ivz7rs8hd85imdz-gash-boot-0.3.0/bin/bash ./config.sub aarch64-linux-gnu failed
>
> Janneke, do you know what could have caused this regression?

This probably has nothing to do with the bootstrap packages. I noticed
that the CI succeeds in building the pine64 image:

The difference is that the CI is building without grafting. Disabling
grafting locally, seems to do the trick as well:

Toggle snippet (3 lines)
./pre-inst-env guix system image gnu/system/images/pine64.scm --no-grafts

The issue seems to be that grafting ends-up dragging the bootstrap
packages into the closure when cross-compiling which is quite scary.

Mathieu
M
M
Mathieu Othacehe wrote on 13 Jan 18:56 +0100
control message for bug #66866
(address . control@debbugs.gnu.org)
87zfx95d85.fsf@meije.mail-host-address-is-not-set
severity 66866 important
quit
M
M
Mathieu Othacehe wrote on 13 Jan 18:57 +0100
(address . control@debbugs.gnu.org)
87y1ct5d75.fsf@meije.mail-host-address-is-not-set
retitle 66866 Grafting breaks cross-compilation
quit
M
M
Mathieu Othacehe wrote on 13 Jan 19:41 +0100
Re: bug#66866: aarch64 system cross compilation + pinebook pro image broken?
(name . dan)(address . i@dan.games)
87ttnh5b4g.fsf@gnu.org
Toggle quote (3 lines)
> The issue seems to be that grafting ends-up dragging the bootstrap
> packages into the closure when cross-compiling which is quite scary.

I could narrow it down somehow.

This commands drags the bootstrap and fails:

Toggle snippet (3 lines)
guix build --target=<any-target> alsa-lib

while this one doesn't:

Toggle snippet (3 lines)
guix build --target=<any-target> alsa-lib --no-grafts

Not sure how to go further. Adding Ludo and Efraim.

Thanks,

Mathieu
D
D
David Elsing wrote on 11 Feb 20:34 +0100
(name . Mathieu Othacehe)(address . othacehe@gnu.org)
86h6ien6bg.fsf@posteo.net
Hello,

Mathieu Othacehe <othacehe@gnu.org> writes:

Toggle quote (2 lines)
> I could narrow it down somehow.

Starting from alsa-lib, I narrowed it down further. I found that the
problem is actually when an input of the package uses copy-build-system.

In the following example, the cross-compilation (with
--target=x86_64-linux-gnu) for testp2 and testp3 works fine. Their
respective inputs are testinput2 (built with trivial-build-system) and
the hello package (built with gnu-build-system).
For testp1 however, whose input testinput1 is created
with copy-build-system, the same thing as for alsa-lib (which depends on
two packages built with copy-build-system) happens: Bootstrap packages
are starting to be built if grafts are used. The outputs of both
testinput1 and testinput2 do not contain store references, so that is
not the issue. It is also no problem to build the packages testinput1,
testinput2 or hello with grafts.

Is there something special about copy-build-system which is not the case
for trivial-build-system and gnu-build-system? I noticed that in
(guix build-system trival) and (guix build-system gnu), there is a
special case for cross-compilation, while in (guix build-system copy),
the same code is used as for a normal build. I don't see why this could
cause an issue with grafts though.

Toggle snippet (88 lines)
(define-module (cc-test)
#:use-module (guix build-system copy)
#:use-module (guix build-system gnu)
#:use-module (guix build-system trivial)
#:use-module (gnu packages base)
#:use-module (guix packages)
#:use-module (guix gexp))

(define-public testinput1
(package
(name "testinput1")
(version "0")
(source
(computed-file
"testp1-src"
#~(begin
(mkdir #$output)
(mkdir (string-append #$output "/dummy")))))
(build-system copy-build-system)
(arguments (list #:install-plan ''(("dummy" "dummy"))))
(home-page "")
(synopsis "")
(description "")
(license #f)))

(define-public testinput2
(package
(name "testinput2")
(version "0")
(source #f)
(build-system trivial-build-system)
(arguments
(list
#:builder
#~(begin
(mkdir #$output)
(mkdir (string-append #$output "/dummy")))))
(home-page "")
(synopsis "")
(description "")
(license #f)))

(define-public testp1
(package
(name "testp1")
(version "0")
(source #f)
(build-system trivial-build-system)
(arguments
(list
#:builder #~(mkdir #$output)))
(inputs (list testinput1))
(home-page "")
(synopsis "")
(description "")
(license #f)))

(define-public testp2
(package
(name "testp2")
(version "0")
(source #f)
(build-system trivial-build-system)
(arguments
(list
#:builder #~(mkdir #$output)))
(inputs (list testinput2))
(home-page "")
(synopsis "")
(description "")
(license #f)))

(define-public testp3
(package
(name "testp3")
(version "0")
(source #f)
(build-system trivial-build-system)
(arguments
(list
#:builder #~(mkdir #$output)))
(inputs (list hello))
(home-page "")
(synopsis "")
(description "")
(license #f)))

Best,
David
D
(name . David Elsing)(address . david.elsing@posteo.net)
87frwn308k.fsf@dan.games
Hi David,

Thanks for sharing your discovery.

David Elsing <david.elsing@posteo.net> writes:

Toggle quote (5 lines)
> Starting from alsa-lib, I narrowed it down further. I found that
> the
> problem is actually when an input of the package uses
> copy-build-system.

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:

Toggle snippet (26 lines)
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.

Any feedback on this would be really helpful.

Best,
--
dan
D
(address . 66866@debbugs.gnu.org)
00dace82-545c-4443-8129-42c932e02ddc@dan.games
Hi all,

I would really appreciate if anyone could give some feedback on my
previous patch to the copy build system.

--
dan
D
D
David Elsing wrote on 10 Apr 22:49 +0200
86frvtvt70.fsf@posteo.net
Hi dan,

sorry for the late reply. I didn't yet find the reason why different
bootstrap packages are built for the cross build when grafts are
applied. This seems possibly like another bug to me, as the package
inputs which use copy-build-system do not contain store references and
it does not happen when they themselves are built with grafts.

dan <i@dan.games> writes:

Toggle quote (2 lines)
> Can we put everything inside build-inputs? From my understanding,
> copy-build-system shouldn't care about cross-compilation at all.
I understand it that way too. In guix/build-system.scm, it is mentioned
that build/host/target are used in the sense of the GNU toolchain [1].
There, "build" is the system used for building and "host" is the target
system for which the package is built. I guess this was confused when
copy-build-system was added [2].

Cheers,
David

D
(name . David Elsing)(address . david.elsing@posteo.net)
912866e9-7775-484f-8ee6-18eab30cbf36@dan.games
Hi David,

Thanks for the reply.

Apr 11, 2024 04:50:03 David Elsing <david.elsing@posteo.net>:

Toggle quote (8 lines)
>> Can we put everything inside build-inputs?  From my understanding,
>> copy-build-system shouldn't care about cross-compilation at all.
> I understand it that way too. In guix/build-system.scm, it is mentioned
> that build/host/target are used in the sense of the GNU toolchain [1].
> There, "build" is the system used for building and "host" is the target
> system for which the package is built. I guess this was confused when
> copy-build-system was added [2].

Then I think I can submit a patch to guix-patches, hoping to bring more
attention to this bug.
D
[PATCH] build-system: copy: Fix cross-compilation.
(address . guix-patches@gnu.org)
20a614ca2a6064bfa597cd11b7b87ceb926de866.1713682643.git.i@dan.games
* guix/build-system/copy.scm (lower): Change arguments passed to host-inputs
and build-inputs.

Change-Id: I2991854b48587ab00ccc03712304e2850727e6b7
---

This patch tries to fix a issue related to grafting when cross-compiling.
See https://issues.guix.gnu.org/66866for more discussion.

guix/build-system/copy.scm | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

Toggle diff (37 lines)
diff --git a/guix/build-system/copy.scm b/guix/build-system/copy.scm
index d58931b33c..64bd61a53f 100644
--- a/guix/build-system/copy.scm
+++ b/guix/build-system/copy.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
;;; Copyright © 2021, 2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2023 Jonathan Brielmaier <jonathan.brielmaier@web.de>
+;;; Copyright © 2024 dan <i@dan.games>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -66,13 +67,13 @@ (define* (lower name
(bag
(name name)
(system system)
- (host-inputs `(,@(if source
- `(("source" ,source))
- '())
- ,@inputs
- ;; Keep the standard inputs of 'gnu-build-system'.
- ,@(standard-packages)))
- (build-inputs native-inputs)
+ (build-inputs `(,@(if source
+ `(("source" ,source))
+ '())
+ ,@inputs
+ ,@native-inputs
+ ;; Keep the standard inputs of 'gnu-build-system'.
+ ,@(standard-packages)))
(outputs outputs)
(build copy-build)
(arguments (strip-keyword-arguments private-keywords arguments))))

base-commit: 38b88d710ea13ba024aed0543bc2862772cdb645
--
2.41.0
L
L
Ludovic Courtès wrote on 1 May 23:39 +0200
Re: bug#66866: Grafting breaks cross-compilation
(name . dan)(address . i@dan.games)
8734r143fv.fsf_-_@gnu.org
Hi,

dan <i@dan.games> skribis:

Toggle quote (34 lines)
> 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

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:
Toggle diff (23 lines)
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))))
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’.
D
D
David Elsing wrote on 12 May 17:39 +0200
86o79byr7v.fsf@posteo.net
Hello,

I think I finally understand why the problem only occurs with grafts if
a dependency uses copy-build-system. It is actually somewhat
complicated.

When a package is lowered into a derivation by 'package->derivation' in
guix/packages.scm, a list of potentially applicable grafts is created by
the 'bag-grafts' procedure.
This works by first traversing the bag for native packages (where
bag-build-inputs and bag-target-inputs are followed recursively; and
also bag-host-inputs if not cross building) and building the native
derivations of the grafted versions of the packages which have a
replacement (such as glibc at the time of writing). Building the grafted
package (in the 'input-graft' procedure) is done again with
'package->derivation', which eventually calls 'graft-derivation' in
guix/grafts.scm, which in turn calls 'non-self-references', where the
ungrafted package is actually built (ignoring the store monad
indirection), not just its derivation.
In the case of cross builds, the bag is also traversed for the target
dependencies, where the bag-host-inputs are followed recursively.
Analogously, this causes the ungrafted packages and their ungrafted
replacement to be cross built to compute the grafted derivations.

As dan found out, the 'lower' procedure in guix/build-system/copy.scm
incorrectly puts standard-packages into the host inputs. They contain
the glibc-final package in gnu/packages/commencement.scm (which inherits
the replacement of glibc). Because copy-build-system puts them into
bag-host-inputs, the package replacement of the glibc-final package is
then cross built without grafts when calculating its grafted derivation,
which it does not support. Note that the glibc-final package and its
package replacement are distinct from the glibc package and its
replacement in gnu/packages/base.scm. I confirmed this by running
Toggle snippet (3 lines)
,use (guix)
(with-store store (run-with-store store (package->cross-derivation (package-replacement (@@ (gnu packages commencement) glibc-final)) "i686-linux-gnu" #:graft? #f)))
in the REPL, which returns the same incorrect glibc derivation that is
attempted to be built as a dependency when running
`guix build alsa-lib --target=i686-linux-gnu`.

It is actually possible to compute the graft derivations only when
needed by a store reference (which does not change the derivation of the
grafted package). Then, this problem does not occur even without the fix
for the copy-build-system, as the invalid derivations are never actually
built. With substitutes or after running GC, this may even prevent
building a package with replacement when the requested package output
which (transitively) depends on it has no (transitive) store reference
to it. I made a patch for that here: https://issues.guix.gnu.org/70895

Regarding the changes to the copy-build-system:

Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (4 lines)
> 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.

In guix/build-system/copy.scm, it is described as an extension of
gnu-build-system and the manual says "It adds much of the
gnu-build-system packages to the set of inputs. Because of this, the
copy-build-system does not require all the boilerplate code often needed
for the trivial-build-system."
Therefore, I think it makes sense to add the copy-cross-build procedure
so that copy-build-system actually behaves like gnu-build-system.

Cheers,
David
?