Subject: bug#28243: Guix cross-compilation doesn't work

From: [email-masked] (Ludovic Courtès)
Date: Tue, 29 Aug 2017 01:15:33 +0200

Hi Manolis,

Manolis Ragkousis <[email-masked]> skribis:

> In current master (72e2815d18ad688b0a16ce3b3efba1172423cec4)
> cross-compilation doesn't work.

I think that’s an overstatement.  :-)

--8<---------------cut here---------------start------------->8---
ludo@ribbon ~/src/guix$ git describe
v0.13.0-2618-g7f090203d
ludo@ribbon ~/src/guix$ ./pre-inst-env guix build --target=powerpc-linux-gnu coreutils -n
substitute: updating list of substitutes from 'https://bayfront.guixsd.org'... 100.0%
substitute: updating list of substitutes from 'https://berlin.guixsd.org'... 100.0%
substitute: updating list of substitutes from 'https://mirror.hydra.gnu.org'... 100.0%
107.3 MB would be downloaded:
   /gnu/store/pz3hpnyhx81k8sqxfrng632qfir5l5xd-coreutils-8.27-debug
   /gnu/store/dq4hvwqianbhjm2s4prpmcjlw956wlh2-coreutils-8.27
   /gnu/store/6dnnh0037rcam3qhz6ign3wi2wygcfpq-gcc-cross-powerpc-linux-gnu-5.4.0
   /gnu/store/czxzd2xcgjq40v9q02r0138716zwwj9c-acl-2.2.52
   /gnu/store/fc9qv46jrw3fr5bp9ll4rdhp4rl6963l-linux-libre-headers-cross-powerpc-linux-gnu-4.4.47
   /gnu/store/pgj7r7pcf1d051ccikl5bcpjq6dljkbw-glibc-cross-powerpc-linux-gnu-2.25
   /gnu/store/ssmm19p3bz215d604zkpkr4f3indjmds-gcc-cross-sans-libc-powerpc-linux-gnu-5.4.0
   /gnu/store/xw4hp3znb926c576gd4ppqqmfc3s8a8i-gmp-6.1.2
ludo@ribbon ~/src/guix$ ./pre-inst-env guix build --target=arm-linux-gnueabihf coreutils -n
substitute: updating list of substitutes from 'https://bayfront.guixsd.org'... 100.0%
substitute: updating list of substitutes from 'https://berlin.guixsd.org'... 100.0%
substitute: updating list of substitutes from 'https://mirror.hydra.gnu.org'... 100.0%
101.7 MB would be downloaded:
   /gnu/store/4qx8vxizyjgvfivax12snz5ya3k91apd-coreutils-8.27-debug
   /gnu/store/xk249y3917689zm2sgdlpi25xc54nfq6-coreutils-8.27
   /gnu/store/dbzs50qvfnrddshr0nlxddk0cxd3rlh0-acl-2.2.52
   /gnu/store/j2nrcggkcxfbggd56bd4nzpaljr87mwv-gcc-cross-arm-linux-gnueabihf-5.4.0
   /gnu/store/lxs1nmi1a5kp7lz3hk8y2152ipwwpnva-gmp-6.1.2
   /gnu/store/wb4kd860x4ql181n073hzswcqb7l8qha-gcc-cross-sans-libc-arm-linux-gnueabihf-5.4.0
   /gnu/store/z74c0dfgy7vpi0lg9axaz7x40sv9yk9r-glibc-cross-arm-linux-gnueabihf-2.25
$ ./pre-inst-env guix build --target=i586-pc-gnu coreutils -n
substitute: updating list of substitutes from 'https://bayfront.guixsd.org'... 100.0%
substitute: updating list of substitutes from 'https://berlin.guixsd.org'... 100.0%
substitute: updating list of substitutes from 'https://mirror.hydra.gnu.org'... 100.0%
109.0 MB would be downloaded:
   /gnu/store/a719clcz6y9600yjz6kr1smqfk7m9zpj-coreutils-8.27-debug
   /gnu/store/0yjqfa6j3b5a6nddqf0s1q0182sc9xsk-coreutils-8.27
   /gnu/store/4x6yybq64fbp0p08dph4sh0pmx60na6z-gcc-cross-sans-libc-i586-pc-gnu-5.4.0
   /gnu/store/5pzranj6vlc1g1gxcfhasvggz0fczsra-gnumach-headers-cross-i586-pc-gnu-1.8
   /gnu/store/5shv1d962kxs8sfrnasmcvx6yi8j1wkc-gcc-cross-i586-pc-gnu-5.4.0
   /gnu/store/jphd29k0ya151v92qri9awmqy2y5gjdm-hurd-headers-cross-i586-pc-gnu-0.9
   /gnu/store/kgbg5gf7ly6fyk57spxbvrzj31kcvv2g-acl-2.2.52
   /gnu/store/mrpfw505k12c4dp7dik8kf4dgcv0m9g4-gmp-6.1.2
   /gnu/store/p04d6sjgy6pivplvr5avsnxkjwwj9q2v-glibc-cross-i586-pc-gnu-2.23
--8<---------------cut here---------------end--------------->8---

However…

> Running `guix build --target=i586-pc-gnu -c8 bootstrap-tarballs' or
> running `guix build --target=i686-linux-gnu -c8 bootstrap-tarballs'
> fail with
>
> phase `set-paths' succeeded after 0.0 seconds
> starting phase `install-locale'
> warning: failed to install 'en_US.utf8' locale: Invalid argument
> phase `install-locale' succeeded after 0.0 seconds
> starting phase `unpack'
> In execvp of tar: No such file or directory
> phase `unpack' failed after 0.0 seconds
>
> http://paste.lisp.org/display/354383

^ followed by:

builder for `/gnu/store/x3i6zasfc97zrwr4c9lj73mh14x5rdwd-make-boot0-4.2.1.drv' failed with exit code 1

This to me suggests a bug in how grafts are applied in a
cross-compilation context: we shouldn’t be trying to cross-compile
‘make-boot0’ in the first place.  I’m pretty sure passing --no-grafts
avoids the problem (but remember it disables some of the security
updates!).  Can you confirm?

(This was reported before, but apparently not on bug-guix.)

> The problem appeared both in master and core-updates before today's
> merge. I think the last time I checked if cross-compilation works, must
> have been in early July. I am looking for the last working commit.

That can be useful too.

Thanks for the report,
Ludo’.