(address . bug-guix@gnu.org)
Hello,
A colleague reported this weird “unbound variable” error message, which
is ignored in this case but can be fatal in other cases (see below):
Toggle snippet (25 lines)
$ guix time-machine -C /tmp/channels.scm -- shell emacs-elementaryx-ox-publish-as-default bash-minimal -n
error: #{ %make-platform-procedure/abi-check}#: unbound variable
hint: Did you forget a `use-modules' form?
14.4 MB would be downloaded
$ cat /tmp/channels.scm
(list (channel
(name 'guix)
(url "https://git.savannah.gnu.org/git/guix.git")
(branch "master")
(commit
"5a95cf76e1d0f9fdff5b232b42337c657b76d1d4")
(introduction
(make-channel-introduction
"9edb3f66fd807b096b48283debdcddccfea34bad"
(openpgp-fingerprint
"BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA"))))
(channel
(name 'guix-hpc)
(url "https://gitlab.inria.fr/guix-hpc/guix-hpc.git")
(branch "master")
(commit
"b7608db6ecff32e2569ed8407d62ac1485e2856a")))
The crux of the problem is that ‘platforms’ happily browses any
‘guix/platforms’ it finds in the load path; in my case, after looking
for guix/platforms modules in this specific Guix instance, it goes on to
browse ~/.guix-home/profile/… and /run/current-system/profile/…, both of
which being on GUILE_LOAD_PATH. The modules it finds there, in this
case, are not ABI-compatible with those of the Guix instance, hence the
error message.
Reduced case:
Toggle snippet (19 lines)
$ guix time-machine -C /tmp/channels.scm -- repl -q
GNU Guile 3.0.9
Copyright (C) 1995-2023 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)> ,use(guix platform)
scheme@(guix-user)> (platform-modules)
error: #{ %make-platform-procedure/abi-check}#: unbound variable
hint: Did you forget a `use-modules' form?
$1 = (#<interface (guix platforms arm) 7f2929e0c8c0> #<interface (guix platforms avr) 7f2929e0c640> #<interface (guix platforms mips) 7f2929e0c3c0> #<interface (guix platforms or1k) 7f2929e0c140> #<interface (guix platforms powerpc) 7f2929ebde60> #<interface (guix platforms riscv) 7f2929ebdbe0> #<interface (guix platforms x86) 7f2929ebd960> #<interface (guix platforms arm) 7f2929e0c8c0> #<interface (guix platforms avr) 7f2929e0c640> #<interface (guix platforms mips) 7f2929e0c3c0> #<interface (guix platforms or1k) 7f2929e0c140> #<interface (guix platforms powerpc) 7f2929ebde60> #<interface (guix platforms riscv) 7f2929ebdbe0> #<interface (guix platforms x86) 7f2929ebd960>)
scheme@(guix-user)> %load-path
$2 = ("/gnu/store/n9xy5r1a0njyn8ml33p4mm8rxfn93drb-guix-module-union/share/guile/site/3.0" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile/3.0" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile/3.0" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile/site/3.0" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile/site" "/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/share/guile" "/home/ludo/.guix-home/profile/share/guile/site/3.0" "/home/ludo/.guix-home/profile/share/guile/site/3.0" "/run/current-system/profile/share/guile/site/3.0")
The same problem exists in:
• ‘image-modules’ in (gnu system images);
• ‘build-system-modules’ in (guix import utils);
• ‘importer-modules’ in (guix upstream);
• ‘bootloader-modules’ in (gnu bootloader).
One radical way to fix it would be to not use anything outside the
module union:
Toggle diff (39 lines)
diff --git a/guix/self.scm b/guix/self.scm
index 2652688c71..85fa3e1467 100644
--- a/guix/self.scm
+++ b/guix/self.scm
@@ -620,22 +620,20 @@ (define* (guix-command modules
(set! %load-extensions '(".scm"))
(set! %load-path
- (append (list (string-append #$module-directory
- "/share/guile/site/"
- (effective-version))
- (string-append #$guile "/share/guile/"
- (effective-version)))
- %load-path))
+ (list (string-append #$module-directory
+ "/share/guile/site/"
+ (effective-version))
+ (string-append #$guile "/share/guile/"
+ (effective-version))))
(set! %load-compiled-path
- (append (list (string-append #$module-directory
- "/lib/guile/"
- (effective-version)
- "/site-ccache")
- (string-append #$guile "/lib/guile/"
- (effective-version)
- "/ccache"))
- %load-compiled-path))
+ (list (string-append #$module-directory
+ "/lib/guile/"
+ (effective-version)
+ "/site-ccache")
+ (string-append #$guile "/lib/guile/"
+ (effective-version)
+ "/ccache")))
;; To maximize the chances that locales are set up right
;; out-of-the-box, bundle "common" UTF-8 locales.
That would make it impossible to use external Guile libraries from ‘guix
repl’, for example.
Another solution would be for all the ‘all-modules’ call sites to limit
their search to (current-profile). Probably better.
Thoughts?
Ludo’.