Subject: bug#44000: Guile-Git cross-compiled to i586-pc-gnu gets bytestructures wrong

From: Taylan Kammer <[email-masked]>
Date: Mon, 16 Nov 2020 18:07:06 +0100

On 16.11.2020 17:10, Ludovic Courtès wrote:
>
> 1.0.9 seems to help my rather involved use case (Guix cross-compiled to
> GNU/Hurd from x86_64-linux, then running ‘guix pull’, which depends on
> Guile-Git, which uses Bytestructures) but it still eventually crashes:
> 
> --8<---------------cut here---------------start------------->8---
> ludo@childhurd ~$ /gnu/store/mxi1za8gdq77438ywgzdzy2zywb9nk76-guix-1.2.0rc1-1.3ba6ffd/bin/guix pull
> Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
> receiving objects  25% [#############                                         ]Illegal instruction
> --8<---------------cut here---------------end--------------->8---
> 
> The problem may well be elsewhere though.

Had you tested the same with your patch?  If it worked with your patch 
but doesn't work with 1.0.9 then I'll have to take another look I guess.

> However, at the REPL I can no longer access the ‘numeric’ module:
> 
> --8<---------------cut here---------------start------------->8---
> ludo@childhurd ~$ /gnu/store/mxi1za8gdq77438ywgzdzy2zywb9nk76-guix-1.2.0rc1-1.3ba6ffd/bin/guix repl
> GNU Guile 3.0.4
> Copyright (C) 1995-2020 Free Software Foundation, Inc.
> 
> Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
> This program is free software, and you are welcome to redistribute it
> under certain conditions; type `,show c' for details.
> 
> Enter `,help' for help.
> scheme@(guix-user)> ,m(bytestructures body numeric)
> While executing meta-command:
> error: environment: unbound variable
> scheme@(guix-user)> (@@ (bytestructures body numeric) arch-32bit?)
> While compiling expression:
> error: environment: unbound variable
> --8<---------------cut here---------------end--------------->8---

One shouldn't try to use (bytestructures body ...) as modules.  The 
files in that directory contain no module-related boilerplate at all, 
including imports, which is why in this case it complains about the lack 
of the binding 'environment'.

The module (bytestructures guile numeric) ought to work, although it 
doesn't contain the binding 'arch32bit?'.  Do you actually need that 
predicate, or was that just for demonstration?  The "right" way to test 
whether the predicate works correctly would be to check whether e.g. 
intptr_t equals int32 or int64 as per 'eq?'.

> Thanks,
> Ludo’.

Hope I was able to help!

Taylan