unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#29091: VPATH builds are broken
@ 2017-10-31 19:15 Eric Bavier
  2017-11-05 13:41 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Bavier @ 2017-10-31 19:15 UTC (permalink / raw)
  To: 29091

Starting at commit 2890ad332fcdfd4bc92b127d783975437c8b718b, vpath builds no longer work.  I.e. one must configure and build in $(top_srcdir).  I believe this also means that `make distcheck` will fail.  I get the following backtrace from compile-all.scm:

```
Backtrace:
In ice-9/boot-9.scm:
 160: 15 [catch #t #<catch-closure d86d160> ...]
In unknown file:
   ?: 14 [apply-smob/1 #<catch-closure d86d160>]
In ice-9/boot-9.scm:
  66: 13 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
 432: 12 [eval # #]
In ice-9/boot-9.scm:
2412: 11 [save-module-excursion #<procedure d8a07c0 at ice-9/boot-9.scm:4084:3 ()>]
4091: 10 [#<procedure d8a07c0 at ice-9/boot-9.scm:4084:3 ()>]
1734: 9 [%start-stack load-stack ...]
1739: 8 [#<procedure d8c46c0 ()>]
In unknown file:
   ?: 7 [primitive-load "/home/users/bavier/src/guix-work/_build/../build-aux/compile-all.scm"]
In ice-9/r4rs.scm:
  90: 6 [dynamic-wind #<procedure f4e2d20 at ice-9/eval.scm:416:20 ()> ...]
  90: 5 [dynamic-wind #<procedure f4e2c60 at ice-9/eval.scm:416:20 ()> ...]
In ice-9/eval.scm:
 432: 4 [eval # #]
 432: 3 [eval # #]
 481: 2 [lp (#<fluid 5>) (#<output: void f6b2dd0>)]
In ice-9/boot-9.scm:
2903: 1 [resolve-interface (.. guix base16) #:select ...]
In unknown file:
   ?: 0 [scm-error misc-error #f "~A ~S" ("no code for module" (.. guix base16)) #f]

ERROR: In procedure scm-error:
ERROR: no code for module (.. guix base16)
Makefile:5269: recipe for target 'make-go' failed
make[2]: *** [make-go] Error 1
make[2]: Leaving directory '/home/users/bavier/src/guix-work/_build'
Makefile:4400: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/users/bavier/src/guix-work/_build'
Makefile:2990: recipe for target 'all' failed
make: *** [all] Error 2
```

Eric Bavier, Scientific Libraries, Cray Inc.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#29091: VPATH builds are broken
  2017-10-31 19:15 bug#29091: VPATH builds are broken Eric Bavier
@ 2017-11-05 13:41 ` Ludovic Courtès
  2017-11-06 15:10   ` Eric Bavier
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2017-11-05 13:41 UTC (permalink / raw)
  To: Eric Bavier; +Cc: 29091

[-- Attachment #1: Type: text/plain, Size: 465 bytes --]

Hi Eric,

Eric Bavier <bavier@cray.com> skribis:

> Starting at commit 2890ad332fcdfd4bc92b127d783975437c8b718b, vpath builds no longer work.  I.e. one must configure and build in $(top_srcdir).  I believe this also means that `make distcheck` will fail.  I get the following backtrace from compile-all.scm:

Good catch!  AFAICS this is fixed by the attached patch.  I’ll commit it
soon if that’s fine with you.

Thanks for your report!

Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-compile-Fix-VPATH-builds.patch --]
[-- Type: text/x-patch, Size: 6620 bytes --]

From 17b45feb84594e57b487d525810d3d70693ad792 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
Date: Sun, 5 Nov 2017 12:49:57 +0100
Subject: [PATCH] compile: Fix VPATH builds.

Fixes <https://bugs.gnu.org/29091>.
Reported by Eric Bavier <bavier@cray.com>.

* guix/build/compile.scm (relative-file): New procedure.
(load-files): Use it before calling 'file-name->module-name'.
(compile-files): Likewise before calling 'scm->go'.
* guix/build/pull.scm (build-guix): Remove 'with-directory-excursion'
and file name hack from ce33c3af76b0e5c68cc42dddf2b9c4b017386fd8.
Pass OUT to 'all-scheme-files'.
---
 guix/build/compile.scm | 28 ++++++++++++++++----------
 guix/build/pull.scm    | 53 +++++++++++++++++++++-----------------------------
 2 files changed, 40 insertions(+), 41 deletions(-)

diff --git a/guix/build/compile.scm b/guix/build/compile.scm
index ea0c36fa3..8b5a2faf8 100644
--- a/guix/build/compile.scm
+++ b/guix/build/compile.scm
@@ -77,6 +77,12 @@
   "Strip the \".scm\" suffix from FILE, and append \".go\"."
   (string-append (string-drop-right file 4) ".go"))
 
+(define (relative-file directory file)
+  "Return FILE relative to DIRECTORY, if possible."
+  (if (string-prefix? (string-append directory "/") file)
+      (string-drop file (+ 1 (string-length directory)))
+      file))
+
 (define* (load-files directory files
                      #:key
                      (report-load (const #f))
@@ -93,13 +99,14 @@
          (report-load #f total completed))
        *unspecified*)
       ((file files ...)
-       (report-load file total completed)
-       (format debug-port "~%loading '~a'...~%" file)
+       (let ((file (relative-file directory file)))
+         (report-load file total completed)
+         (format debug-port "~%loading '~a'...~%" file)
 
-       (parameterize ((current-warning-port debug-port))
-         (resolve-interface (file-name->module-name file)))
+         (parameterize ((current-warning-port debug-port))
+           (resolve-interface (file-name->module-name file)))
 
-       (loop files (+ 1 completed))))))
+         (loop files (+ 1 completed)))))))
 
 (define-syntax-rule (with-augmented-search-path path item body ...)
   "Within the dynamic extent of BODY, augment PATH by adding ITEM to the
@@ -135,11 +142,12 @@ files are for HOST, a GNU triplet such as \"x86_64-linux-gnu\"."
     (with-fluids ((*current-warning-prefix* ""))
       (with-target host
         (lambda ()
-          (compile-file file
-                        #:output-file (string-append build-directory "/"
-                                                     (scm->go file))
-                        #:opts (append warning-options
-                                       (optimization-options file))))))
+          (let ((relative (relative-file source-directory file)))
+            (compile-file file
+                          #:output-file (string-append build-directory "/"
+                                                       (scm->go relative))
+                          #:opts (append warning-options
+                                         (optimization-options relative)))))))
     (with-mutex progress-lock
       (set! completed (+ 1 completed))))
 
diff --git a/guix/build/pull.scm b/guix/build/pull.scm
index 3573241a7..a011e366f 100644
--- a/guix/build/pull.scm
+++ b/guix/build/pull.scm
@@ -121,41 +121,32 @@ containing the source code.  Write any debugging output to DEBUG-PORT."
 
     ;; Compile the .scm files.  Hide warnings.
     (parameterize ((current-warning-port (%make-void-port "w")))
-      (with-directory-excursion out
-        ;; Filter out files depending on Guile-SSH when Guile-SSH is missing.
-        (let ((files (filter has-all-its-dependencies?
-                             (all-scheme-files "."))))
-          (compile-files out out
+      ;; Filter out files depending on Guile-SSH when Guile-SSH is missing.
+      (let ((files (filter has-all-its-dependencies?
+                           (all-scheme-files out))))
+        (compile-files out out files
 
-                         ;; XXX: 'compile-files' except ready-to-use relative
-                         ;; file names.
-                         (map (lambda (file)
-                                (if (string-prefix? "./" file)
-                                    (string-drop file 2)
-                                    file))
-                              files)
+                       #:workers (parallel-job-count)
 
-                         #:workers (parallel-job-count)
+                       ;; Disable warnings.
+                       #:warning-options '()
 
-                         ;; Disable warnings.
-                         #:warning-options '()
+                       #:report-load
+                       (lambda (file total completed)
+                         (display #\cr log-port)
+                         (format log-port
+                                 "loading...\t~5,1f% of ~d files" ;FIXME: i18n
+                                 (* 100. (/ completed total)) total)
+                         (force-output log-port)
+                         (format debug-port "~%loading '~a'...~%" file))
 
-                         #:report-load
-                         (lambda (file total completed)
-                           (display #\cr log-port)
-                           (format log-port
-                                   "loading...\t~5,1f% of ~d files" ;FIXME: i18n
-                                   (* 100. (/ completed total)) total)
-                           (force-output log-port)
-                           (format debug-port "~%loading '~a'...~%" file))
-
-                         #:report-compilation
-                         (lambda (file total completed)
-                           (display #\cr log-port)
-                           (format log-port "compiling...\t~5,1f% of ~d files" ;FIXME: i18n
-                                   (* 100. (/ completed total)) total)
-                           (force-output log-port)
-                           (format debug-port "~%compiling '~a'...~%" file)))))))
+                       #:report-compilation
+                       (lambda (file total completed)
+                         (display #\cr log-port)
+                         (format log-port "compiling...\t~5,1f% of ~d files" ;FIXME: i18n
+                                 (* 100. (/ completed total)) total)
+                         (force-output log-port)
+                         (format debug-port "~%compiling '~a'...~%" file))))))
 
   (newline)
   #t)
-- 
2.14.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#29091: VPATH builds are broken
  2017-11-05 13:41 ` Ludovic Courtès
@ 2017-11-06 15:10   ` Eric Bavier
  2017-11-06 23:15     ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Bavier @ 2017-11-06 15:10 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 29091@debbugs.gnu.org

LGTM.  Thanks for the quick fix!

Eric Bavier, Scientific Libraries, Cray Inc.

________________________________________
From: Ludovic Courtès <ludo@gnu.org>
Sent: Sunday, November 5, 2017 07:41
To: Eric Bavier
Cc: 29091@debbugs.gnu.org
Subject: Re: bug#29091: VPATH builds are broken

Hi Eric,

Eric Bavier <bavier@cray.com> skribis:

> Starting at commit 2890ad332fcdfd4bc92b127d783975437c8b718b, vpath builds no longer work.  I.e. one must configure and build in $(top_srcdir).  I believe this also means that `make distcheck` will fail.  I get the following backtrace from compile-all.scm:

Good catch!  AFAICS this is fixed by the attached patch.  I’ll commit it
soon if that’s fine with you.

Thanks for your report!

Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#29091: VPATH builds are broken
  2017-11-06 15:10   ` Eric Bavier
@ 2017-11-06 23:15     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2017-11-06 23:15 UTC (permalink / raw)
  To: Eric Bavier; +Cc: 29091@debbugs.gnu.org

Eric Bavier <bavier@cray.com> skribis:

> LGTM.  Thanks for the quick fix!

Pushed as c9405c461b1b37740bc0bb33c7043313978c0014, thanks!

Ludo'.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-06 23:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-31 19:15 bug#29091: VPATH builds are broken Eric Bavier
2017-11-05 13:41 ` Ludovic Courtès
2017-11-06 15:10   ` Eric Bavier
2017-11-06 23:15     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).