Subject: bug#54198: Guile 3.0.8 cross-compiled to i586-pc-gnu crashes

From: Ludovic Courtès <[email-masked]>
Date: Mon, 28 Feb 2022 11:16:33 +0100

Hi,

Guix’s Guile 3.0.8 package cross-compiled to i586-pc-gnu (GNU/Hurd)
crashes when starting (3.0.7 was fine):

--8<---------------cut here---------------start------------->8---
ludo@childhurd ~$ /gnu/store/19dfmmsy41614n9nxkbpn73sr8xhccqy-guile-3.0.7/bin/guile --version
guile (GNU Guile) 3.0.7
Copyright (C) 2021 Free Software Foundation, Inc.

License LGPLv3+: GNU LGPL 3 or later <http://gnu.org/licenses/lgpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
ludo@childhurd ~$ /gnu/store/hh72mzfk2h4ss5rnzhbhycdibb8qy8wi-guile-3.0.8/bin/guile --version
Pre-boot error; key: out-of-range, args: (#f "Value out of range ~S to< ~S: ~S" (0 -1 1) (1))Aborted
ludo@childhurd ~$ gdb --args guile --version
GNU gdb (GDB) 11.1

[...]

Pre-boot error; key: out-of-range, args: (#f "Value out of range ~S to< ~S: ~S" (0 -1 1) (1))
Thread 4 received signal SIGABRT, Aborted.
0x015080cc in mach_msg_trap () at /tmp/guix-build-glibc-cross-i586-pc-gnu-2.33.drv-0/build/mach/mach_msg_trap.S:2
2       /tmp/guix-build-glibc-cross-i586-pc-gnu-2.33.drv-0/build/mach/mach_msg_trap.S: No such file or directory.
(gdb) bt
#0  0x015080cc in mach_msg_trap () at /tmp/guix-build-glibc-cross-i586-pc-gnu-2.33.drv-0/build/mach/mach_msg_trap.S:2
#1  0x015087fa in __GI___mach_msg (msg=0x1038880, option=3, send_size=48, rcv_size=32, rcv_name=125, timeout=0, 
    notify=0) at msg.c:111
#2  0x0176824e in __msg_sig_post (process=122, signal=0, sigcode=0, refport=1)
    at /tmp/guix-build-glibc-cross-i586-pc-gnu-2.33.drv-0/build/hurd/RPC_msg_sig_post.c:149
#3  0x015291ea in __GI__hurd_raise_signal (ss=<optimized out>, signo=6, detail=0x103891c) at hurd-raise.c:56
#4  0x011f8c93 in __pthread_kill (thread=1, sig=6) at ../sysdeps/hurd/htl/pt-kill.c:49
#5  0x01552e47 in __GI_raise (signo=6) at ../sysdeps/htl/raise.c:38
#6  0x01507e29 in __GI_abort () at abort.c:79
#7  0x010f2750 in scm_throw (key=0x20202e0, args=0x2047000) at throw.c:260
#8  0x010f27ce in scm_ithrow (key=0x20202e0, args=0x2047000, no_return=1) at throw.c:457
#9  0x01074fc8 in scm_error_scm (key=0x20202e0, subr=0x4, message=0x2046090, args=0x2047020, data=0x2047038)
    at error.c:90
#10 0x0107502b in scm_error (key=0x20202e0, subr=0x0, message=0x1129cac "Value out of range ~S to< ~S: ~S", 
    args=0x2047020, rest=0x2047038) at error.c:62
#11 0x010b68dc in range_error (bad_val=bad_val@entry=0x6, min=0x2, max=max@entry=0xfffffffe) at numbers.c:6611
#12 0x010b6b8f in inum_in_range (max=-1, min=0, x=0x6) at numbers.c:6630
#13 scm_to_uint32 (arg=0x6) at numbers.c:6787
#14 0x0109c1d0 in scm_make_list (n=0x6, init=0x20460a0) at list.c:113
#15 0x010806a1 in make_exp_vtable (n=0) at expand.c:1602
#16 scm_init_expand () at expand.c:1650
#17 0x01095211 in scm_i_init_guile (base=<optimized out>) at init.c:475
#18 0x010f1268 in scm_i_init_guile (base=0x1038cbc) at init.c:357
#19 scm_i_init_thread_for_guile.part.0.lto_priv.0 (base=0x1038cbc, dynamic_state=0x0) at threads.c:570
#20 0x010f037b in scm_i_init_thread_for_guile (dynamic_state=0x0, base=0x1038cbc) at threads.c:677
#21 with_guile (base=0x1038cbc, data=0x1038ce4) at threads.c:638
#22 0x011a51f4 in GC_call_with_stack_base ()
   from /gnu/store/y62sfzpnw3r7i5c0k4aqq9cy9c6hkr2g-libgc-8.0.4/lib/libgc.so.1
#23 0x010e8cda in scm_i_with_guile (dynamic_state=<optimized out>, data=0x1038d10, func=0x1088f40 <invoke_main_func>)
    at threads.c:688
#24 scm_with_guile (func=0x1088f40 <invoke_main_func>, data=0x1038d10) at threads.c:694
#25 0x01092400 in scm_boot_guile (argc=2, argv=0x1038df4, main_func=0x80492b0 <inner_main>, closure=0x0) at init.c:295
#26 0x0804911a in main (argc=2, argv=0x1038df4) at guile.c:94
--8<---------------cut here---------------end--------------->8---

The build process of Guile changed upstream to become multi-stage, in
support of cross-module inlining.  A possibility is that that somehow
ends up generating .go files with the wrong word size (although that
should prevent them from being loaded).  Or maybe it’s some interference
with the native Guile that’s being used.

Ludo’.