Subject: bug#55833: cross-base error: wrong type argument in position 1

From: Ekaitz Zarraga <[email-masked]>
Date: Tue, 07 Jun 2022 15:43:13 +0000

Hi all,

I'm experiencing the following error when I try to make something like (cross-libc "riscv64-unknown-linux-gnu") and it broke in every single setup I already have for months and was working properly. In fact, it works as expected when using a time-machine to the past.

```
$ guix shell -m manifest.scm
Backtrace:
In guix/scripts/environment.scm:
   953:13 19 (_)
In guix/store.scm:
  2168:25 18 (run-with-store #<store-connection 256.99 7f651e026870> …)
In guix/scripts/environment.scm:
   955:14 17 (_ _)
In guix/profiles.scm:
    627:3 16 (_ _)
In srfi/srfi-1.scm:
   586:29 15 (map1 (#<<manifest-entry> name: "gcc" version: "4.6.…> …))
   586:29 14 (map1 (#<<manifest-entry> name: "binutils-cross-risc…> …))
   586:17 13 (map1 (#<<manifest-entry> name: "glibc-cross-riscv64…> …))
In guix/profiles.scm:
  1889:19 12 (_ _)
In guix/packages.scm:
  1269:17 11 (supported-package? #<package glibc-cross-riscv64-unkn…> …)
In guix/memoization.scm:
    101:0 10 (_ #<hash-table 7f650b8bae00 153/223> #<package glibc-…> …)
In guix/packages.scm:
  1239:12  9 (_)
In srfi/srfi-1.scm:
   460:18  8 (fold #<procedure 7f650ba4b540 at guix/packages.scm:12…> …)
In guix/packages.scm:
  1243:42  7 (_ _ ("x86_64-linux" "i686-linux"))
In guix/memoization.scm:
    101:0  6 (_ #<hash-table 7f650b8bae00 153/223> #<package linux-…> …)
In guix/packages.scm:
  1247:37  5 (_)
  1507:16  4 (package->bag _ _ _ #:graft? _)
  1612:43  3 (thunk)
In gnu/packages/cross-base.scm:
   352:33  2 (loop (#:phases (modify-phases %standard-phases # …) …) #)
In ice-9/boot-9.scm:
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure struct-vtable: Wrong type argument in position 1 (expecting struct): #f
```

I think the error was introduced in the commit b55310603f0df7d5ae02d47cb8d4be58bf1d41ca but I can't really explain what's happening.

You can replicate this using the manifest from: https://github.com/ekaitz-zarraga/gcc

It won't work if you have guix updated, but it will if you use the time-machine with the `channels.scm` file in the same repo.

You can also try with smaller packages (the repo is a full gcc4.6, use it under your own risk (: ), anything that uses `(cross-libc "riscv64-unknown-linux-gnu")` will trigger the error.

I would fix this myself but I don't really understand what's going on. If anyone guides me a little I'm open to fix it myself.

Thank you all!
Ekaitz

ElenQ Technology
Ethical Innovation