help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Debugging cross-compilation dependencies


From: Philip McGrath
Subject: Debugging cross-compilation dependencies
Date: Sat, 23 Jul 2022 07:30:01 -0400
User-agent: Cyrus-JMAP/3.7.0-alpha0-757-gc3ad9c75d3-fm-20220722.001-gc3ad9c75

Hi Guix,

For the upcoming Racket 8.6 release, I've been trying to get the 
Chez-Scheme–based implementation working for architectures without native 
code-generation backends [1] and initial support for cross-compilation. (Full 
support for cross-compilation will come after there is a `racket-build-system`, 
since it involved building a cross-compilation plugin for the compiler, and 
tooling for doing so lives in a different package, but I had a problem during 
the bootstrapping process with QEMU [2].)

I thought I had things working at least up through `chez-scheme-for-racket`, 
but, when I later removed the QEMU binfmt_misc package from my (foreign) 
system, I discovered that a dependency was incorrectly being cross-compiled 
when it needed to be run on the build machine. Specifically, the problem was 
with Zuo (a tiny Racket-like language for build scripts, [3] which replaces 
complex makefiles in 8.6), which was particularly surprising, since it is only 
ever used in `native-inputs`.

I've put my work in progress at [4]. With that Guix commit, if I run 
`./pre-inst-env guix build --keep-failed --target=powerpc64le-linux-gnu 
chez-scheme-for-racket`, the log shows that these flags get passed to Zuo's 
configure (generated via Autoconf):

```
configure flags: ("CC_FOR_BUILD=gcc" 
"CONFIG_SHELL=/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/bin/bash"
 
"SHELL=/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/bin/bash" 
"--prefix=/gnu/store/ldjkknahc9hl6vzc6mqxa5zga4qd4lmf-zuo-1.0-racket8.5.900-guix1"
 "--enable-fast-install" "--build=x86_64-unknown-linux-gnu" 
"--host=powerpc64le-linux-gnu" 
"--prefix=/gnu/store/ldjkknahc9hl6vzc6mqxa5zga4qd4lmf-zuo-1.0-racket8.5.900-guix1"
 
"CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH=/gnu/store/q9pidl3hg9l0qga88gsgjs8brv82qy0v-bash-minimal-5.1.8/bin/sh")
```

which leads to:

```
starting phase `build'
powerpc64le-linux-gnu-gcc 
-DGUIX_RKTIO_PATCH_BIN_SH=/gnu/store/q9pidl3hg9l0qga88gsgjs8brv82qy0v-bash-minimal-5.1.8/bin/sh
 -g -O2 -DZUO_LIB_PATH='"'"../zuo/lib"'"' -o zuo ../zuo/zuo.c  
./zuo . zuos-to-run-and-install
./zuo: ./zuo: cannot execute binary file
make: *** [Makefile:24: zuos-to-run-and-install] Error 126
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "make" arguments: ("-j" "12") exit-status: 
2 term-signal: #f stop-signal: #f> 
phase `build' failed after 2.2 seconds
command "make" "-j" "12" failed with status 2
note: keeping build directory 
`/tmp/guix-build-zuo-1.0-racket8.5.900-guix1.drv-4'
builder for 
`/gnu/store/66n0cf0fyzwbv5j29f12if2ghk69p7vq-zuo-1.0-racket8.5.900-guix1.drv' 
failed with exit code 1
build of 
/gnu/store/66n0cf0fyzwbv5j29f12if2ghk69p7vq-zuo-1.0-racket8.5.900-guix1.drv 
failed
View build log at 
'/var/log/guix/drvs/66/n0cf0fyzwbv5j29f12if2ghk69p7vq-zuo-1.0-racket8.5.900-guix1.drv.gz'.
cannot build derivation 
`/gnu/store/4lrhirlyp0h7bb3ihwdknh86pm8yvlgx-chez-scheme-for-racket-9.5.9.2.drv':
 1 dependencies couldn't be built
guix build: error: build of 
`/gnu/store/4lrhirlyp0h7bb3ihwdknh86pm8yvlgx-chez-scheme-for-racket-9.5.9.2.drv'
 failed
```

(It's an additional issue that cross-compiling Zuo currently fails, but that's 
unrelated to the fact that we shouldn't be trying to cross-compile Zuo.)

I'm not sure how to debug this. In particular, `guix graph` doesn't seem to 
support `--target=`.

-Philip

[1]: 
https://racket.discourse.group/t/chez-for-architectures-without-native-backends/950
[2]: 
https://racket.discourse.group/t/chez-for-architectures-without-native-backends/950/13
[3]: https://docs.racket-lang.org/zuo/
[4]: 
https://gitlab.com/philip1/guix-patches/-/commit/e28ff4c0f520a88aa781f847f52b0bbd12948caa



reply via email to

[Prev in Thread] Current Thread [Next in Thread]