Subject: poor error tracing

From: Robert Vollmert <[email-masked]>
Date: Sun, 16 Jun 2019 18:11:29 +0200

I’m not sure if this lies more with guile or with guix, but there’s definitely
room for improvment either way.

I was working on https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36084,
haskell-check.scm was changed as follows:

-       ("ghc-clock-bootstrap" ,ghc-clock-bootstrap)
+       ("ghc-clock-bootstrap" ,(@@ (gnu packages haskell) ghc-clock-bootstrap))

In haskell.scm I had a working package definition for ghc-clock-bootstrap,
and added a definition for ghc-clock along these lines:

+(define-public ghc-clock
+  (package
+    (inherit ghc-clock-bootstrap)
+    (name "ghc-clock")
+    ;;(version "0.7.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://hackage.haskell.org/package/"
+             "clock/"
+             "clock-" version ".tar.gz"))
+       (sha256
+        (base32 "07v91s20halsqjmziqb1sqjp2sjpckl9by7y28aaklwqi2bh2rl8"))
+       (patches
+        (search-patches
+         "ghc-clock-disable-library.patch"))))
+    (inputs
+     `(("ghc-tasty" ,ghc-tasty)
+       ("ghc-tasty-quickcheck" ,ghc-tasty-quickcheck)))
+    (arguments
+     `(#:tests? #t))))
+

This is broken due to the reference to version, fixed by uncommenting the
version field. The problem is with the error messages:

  guix build ghc-clock

gave pages of warnings, ending with a plain

  guix build: error: ghc-clock: unknown package

Knowing I’d edited haskell.scm and it worked fine before, I ran

  guild compile haskell.scm

which hung.

Finally

  guild compile haskell-check.scm

very subtly pointed me at some issue with version in haskell.scm. Full
output below.

~/guix [env]$ ./pre-inst-env guix build ghc-clock
;;; note: source file /home/rob/guix/gnu/packages/haskell.scm
;;;       newer than compiled /home/rob/guix/gnu/packages/haskell.go
;;; note: source file /home/rob/guix/gnu/packages/haskell.scm
;;;       newer than compiled /run/current-system/profile/lib/guile/2.2/site-ccache/gnu/packages/haskell.go
;;; note: source file /home/rob/guix/gnu/packages/haskell.scm
;;;       newer than compiled /home/rob/.cache/guile/ccache/2.2-LE-8-3.A/home/rob/guix/gnu/packages/haskell.scm.go
;;; note: source file /home/rob/guix/gnu/packages/haskell-check.scm
;;;       newer than compiled /home/rob/guix/gnu/packages/haskell-check.go
;;; note: source file /home/rob/guix/gnu/packages/haskell-check.scm
;;;       newer than compiled /run/current-system/profile/lib/guile/2.2/site-ccache/gnu/packages/haskell-check.go
guix build: warning: failed to load '(gnu packages abiword)':
In procedure string-append: Wrong type (expecting string): #<procedure version ()>
guix build: warning: failed to load '(gnu packages android)':
In procedure module-lookup: Unbound variable: googletest
guix build: warning: failed to load '(gnu packages antivirus)':
In procedure module-lookup: Unbound variable: bzip2
guix build: warning: failed to load '(gnu packages avr)':
In procedure module-lookup: Unbound variable: binutils
guix build: warning: failed to load '(gnu packages axoloti)':
In procedure module-lookup: Unbound variable: gcc-4.9
guix build: warning: failed to load '(gnu packages benchmark)':
In procedure module-lookup: Unbound variable: openmpi
guix build: warning: failed to load '(gnu packages bioconductor)':
In procedure module-lookup: Unbound variable: perl-module-build
guix build: warning: failed to load '(gnu packages bootloaders)':
no binding `bc' in module (gnu packages algebra)
guix build: warning: failed to load '(gnu packages chemistry)':
In procedure module-lookup: Unbound variable: python2-numpy
guix build: warning: failed to load '(gnu packages commencement)':
In procedure module-lookup: Unbound variable: gnu-make
guix build: warning: failed to load '(gnu packages debug)':
In procedure module-lookup: Unbound variable: gnu-make
guix build: warning: failed to load '(gnu packages games)':
In procedure module-lookup: Unbound variable: python
guix build: warning: failed to load '(gnu packages image-viewers)':
In procedure module-lookup: Unbound variable: curl
guix build: warning: failed to load '(gnu packages julia)':
In procedure module-lookup: Unbound variable: libuv
guix build: warning: failed to load '(gnu packages kodi)':
In procedure module-lookup: Unbound variable: libdvdnav
guix build: warning: failed to load '(gnu packages license)':
In procedure module-lookup: Unbound variable: perl
guix build: warning: failed to load '(gnu packages make-bootstrap)':
In procedure module-lookup: Unbound variable: coreutils
guix build: warning: failed to load '(gnu packages maven)':
In procedure module-lookup: Unbound variable: java-plexus-container-default
guix build: warning: failed to load '(gnu packages profiling)':
In procedure module-lookup: Unbound variable: openmpi
guix build: warning: failed to load '(gnu packages syndication)':
In procedure module-lookup: Unbound variable: curl
guix build: error: ghc-clock: unknown package

~/guix [env]$ ./pre-inst-env guild compile gnu/packages/haskell.scm 
;;; note: source file /home/rob/guix/gnu/packages/haskell-check.scm
;;;       newer than compiled /home/rob/guix/gnu/packages/haskell-check.go
;;; note: source file /home/rob/guix/gnu/packages/haskell-check.scm
;;;       newer than compiled /run/current-system/profile/lib/guile/2.2/site-ccache/gnu/packages/haskell-check.go

[ hangs ]

~/guix [env]$ ./pre-inst-env guild compile gnu/packages/haskell-check.scm 
;;; note: source file /home/rob/guix/gnu/packages/haskell.scm
;;;       newer than compiled /home/rob/guix/gnu/packages/haskell.go
;;; note: source file /home/rob/guix/gnu/packages/haskell.scm
;;;       newer than compiled /run/current-system/profile/lib/guile/2.2/site-ccache/gnu/packages/haskell.go
;;; note: source file /home/rob/guix/gnu/packages/haskell.scm
;;;       newer than compiled /home/rob/.cache/guile/ccache/2.2-LE-8-3.A/home/rob/guix/gnu/packages/haskell.scm.go
Backtrace:
In ice-9/eval.scm:
   293:34 19 (_ #<module (#{ g77}#) c450a0>)
In ice-9/boot-9.scm:
   2874:4 18 (define-module* _ #:filename _ #:pure _ #:version _ # _ …)
  2071:24 17 (call-with-deferred-observers _)
  2887:24 16 (_)
   222:29 15 (map1 _)
   222:17 14 (map1 (((gnu packages haskell)) ((gnu packages #)) (#) …))
  2800:17 13 (resolve-interface (gnu packages haskell) #:select _ # _ …)
In ice-9/threads.scm:
    390:8 12 (_ _)
In ice-9/boot-9.scm:
  2726:13 11 (_)
In ice-9/threads.scm:
    390:8 10 (_ _)
In ice-9/boot-9.scm:
  2994:20  9 (_)
   2312:4  8 (save-module-excursion _)
  3014:26  7 (_)
In unknown file:
           6 (primitive-load-path "gnu/packages/haskell" #<procedure…>)
In ice-9/eval.scm:
    619:8  5 (_ #f)
   626:19  4 (_ #<directory (gnu packages haskell) 1108b40>)
   293:34  3 (_ #(#<directory (gnu packages haskell) 1108b40> "ghc…"))
   293:34  2 (_ #(#(#<directory (gnu packages haskell) 1108b40> #) #))
In unknown file:
           1 (string-append "https://hackage.haskell.org/package/" # …)
In ice-9/boot-9.scm:
   752:25  0 (dispatch-exception _ _ _)

ice-9/boot-9.scm:752:25: In procedure dispatch-exception:
In procedure string-append: Wrong type (expecting string): #<procedure version ()>