Andy Wingo <wi...@igalia.com> writes:

> On Wed 21 Sep 2016 10:23, l...@gnu.org (Ludovic Courtès) writes:
>
>> Hello!
>>
>> Nalaginrut reported that Guix fails to build with Guile 2.2, which was a
>> bit of a shame, hence commits e465d9e19087ab150f7e31f21c09e4a147b93b36
>> and 9d126aa2b504bb9fad536eac186805ff623e96be.
>>
>> Now, the hack in build-aux/compile-all.scm doesn’t quite work with 2.2,
>> and it was already quite fragile.
>
> Which hack?  You mean loading modules before compiling?  I guess you
> should load the compiler modules too FWIW, perhaps that's an issue.
>
> If there is a nice change we can do to make module-loading thread-safe,
> let's think about that :)  It's probably the biggest thread-safety
> problem we have in Guile and now would be the right time to fix it.

It would be neat to make module loading thread-safe indeed!  Not sure if
this issue is related to that though...  Currently the .go compilation
phase of 'make' errors like:

> [... snip ...]
>   LOAD     (guix build-system haskell)
>   LOAD     (guix build-system perl)
>   LOAD     (guix build-system python)
>   LOAD     (guix build-system waf)
> Backtrace:
>           18 (primitive-load "/home/taylan/src/guix/./build-aux/comp?")
> In ice-9/eval.scm:
>     608:8 17 (_ #(#(#(#(#(#<directory (guile-user) 26?> ?) ?) ?) ?) ?))
> In ice-9/boot-9.scm:
>    262:13 16 (for-each1 ("guix/build-system/waf.scm" "guix/build-?" ?))
>   2788:17 15 (resolve-interface (guix build-system waf) #:select _ # ?)
>   2713:10 14 (_ (guix build-system waf) _ _ #:ensure _)
>   2989:16 13 (try-module-autoload _ _)
>    2325:4 12 (save-module-excursion #<procedure 2fb5390 at ice-9/boo?>)
>   3009:22 11 (_)
> In unknown file:
>           10 (primitive-load-path "guix/build-system/waf" #<procedur?>)
> In ice-9/eval.scm:
>    710:20  9 (primitive-eval (define-module (guix build-system #) # ?))
> In ice-9/psyntax.scm:
>   1209:36  8 (expand-top-sequence ((define-module (guix # waf) # ?)) ?)
>   1156:24  7 (parse _ (("placeholder" placeholder)) ((top) #(# # ?)) ?)
>    279:10  6 (parse _ (("placeholder" placeholder)) (()) _ c&e (eval) ?)
> In ice-9/eval.scm:
>    293:34  5 (_ #<module (#{ g141635}#) 4809000>)
> In ice-9/boot-9.scm:
>   2849:10  4 (define-module* _ #:filename _ #:pure _ #:version _ # _ ?)
>   2801:10  3 (resolve-interface (guix build-system python) #:select _ ?)
>    262:13  2 (for-each1 (default-python default-python2))
>   2806:38  1 (_ _)
> In unknown file:
>            0 (scm-error misc-error #f "~A" ("no binding `default-p?") ?)
>
> ERROR: In procedure scm-error:
> ERROR: no binding `default-python' in module (guix build-system python)

That's in the phase where the modules are all loaded by calling
'resolve-interface' on their names, which is *not* done in parallel.
To quote compile-all.scm:

> [... snip ...]
>
> ;;; To work around <http://bugs.gnu.org/15602> (FIXME), we want to load all
> ;;; files to be compiled first.  We do this via resolve-interface so that the
> ;;; top-level of each file (module) is only executed once.
> (define (load-module-file file)
>   (let ((module (file->module file)))
>     (format #t "  LOAD     ~a~%" module)
>     (resolve-interface module)))
>
> [... snip ...]
>
> (match (command-line)
>   ((_ . files)
>    (let ((files (filter file-needs-compilation? files)))
>      (for-each load-module-file files)
>      (let ((mutex (make-mutex)))
>        (par-for-each (lambda (file)
>                        (compile-file* file mutex))
>                      files)))))

I ran guile via ./pre-inst-env and executed (resolve-interface '(guix
build-system waf)) manually and actually got a similar / the same error:

> [... snip ...]
> ;;; WARNING: compilation of /home/taylan/src/guix/guix/build-system/waf.scm 
> failed:
> ;;; ERROR: no binding `default-python' in module (guix build-system python)
> ERROR: In procedure scm-error:
> ERROR: no binding `default-python' in module (guix build-system python)

Looking into (guix build-system waf), it contains:

> ...
>   #:use-module ((guix build-system python)
>                 #:select (default-python default-python2))
> ...

but (guix build-system python) does not export default-python.

Apparently Guile 2.0 allows this (to select private bindings), but 2.2
does not.

Reading the documentation for #:select I can't really tell which
behavior is intended.

Taylan

Reply via email to