* Debugging cross-compilation dependencies
@ 2022-07-23 11:30 Philip McGrath
2022-07-29 5:36 ` Philip McGrath
0 siblings, 1 reply; 4+ messages in thread
From: Philip McGrath @ 2022-07-23 11:30 UTC (permalink / raw)
To: help-guix
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Debugging cross-compilation dependencies
2022-07-23 11:30 Debugging cross-compilation dependencies Philip McGrath
@ 2022-07-29 5:36 ` Philip McGrath
2022-08-09 20:16 ` Ludovic Courtès
2022-08-09 20:16 ` Ludovic Courtès
0 siblings, 2 replies; 4+ messages in thread
From: Philip McGrath @ 2022-07-29 5:36 UTC (permalink / raw)
To: help-guix
On Sat, Jul 23, 2022, at 7:30 AM, Philip McGrath wrote:
> 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].
Much to my surprise, I discovered I can avoid the problem by changing code for #:make-flags like this:
```
#~(string-append "ZUO="
#$(this-package-native-input "zuo")
"/bin/zuo"))
```
to instead use `%build-inputs`, like this:
```
#~(string-append "ZUO="
(search-input-file %build-inputs
"/bin/zuo"))
```
Is this expected behavior? Maybe `this-package-native-input` is supposed to only be used under `ungexp-native`, rather than `ungexp`?
-Philip
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Debugging cross-compilation dependencies
2022-07-29 5:36 ` Philip McGrath
@ 2022-08-09 20:16 ` Ludovic Courtès
2022-08-09 20:16 ` Ludovic Courtès
1 sibling, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2022-08-09 20:16 UTC (permalink / raw)
To: Philip McGrath; +Cc: help-guix
Hello!
"Philip McGrath" <philip@philipmcgrath.com> skribis:
> Much to my surprise, I discovered I can avoid the problem by changing code for #:make-flags like this:
>
> ```
> #~(string-append "ZUO="
> #$(this-package-native-input "zuo")
> "/bin/zuo"))
> ```
You should prolly use ‘ungexp-native’ (aka. #+) instead of ‘ungexp’ (#$).
#~(string-append … #+(this-package-native-input "zuo") …)
HTH!
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Debugging cross-compilation dependencies
2022-07-29 5:36 ` Philip McGrath
2022-08-09 20:16 ` Ludovic Courtès
@ 2022-08-09 20:16 ` Ludovic Courtès
1 sibling, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2022-08-09 20:16 UTC (permalink / raw)
To: Philip McGrath; +Cc: help-guix
Hello!
"Philip McGrath" <philip@philipmcgrath.com> skribis:
> Much to my surprise, I discovered I can avoid the problem by changing code for #:make-flags like this:
>
> ```
> #~(string-append "ZUO="
> #$(this-package-native-input "zuo")
> "/bin/zuo"))
> ```
You should prolly use ‘ungexp-native’ (aka. #+) instead of ‘ungexp’ (#$).
#~(string-append … #+(this-package-native-input "zuo") …)
HTH!
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-08-09 20:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-23 11:30 Debugging cross-compilation dependencies Philip McGrath
2022-07-29 5:36 ` Philip McGrath
2022-08-09 20:16 ` Ludovic Courtès
2022-08-09 20:16 ` Ludovic Courtès
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).