From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.lisp.guile.bugs Subject: bug#10474: Building guile 2.x under mingw + msys Date: Thu, 19 Jan 2012 19:35:04 +0200 Message-ID: <83obtz4muv.fsf@gnu.org> References: <87pqerdxq4.fsf@pobox.com> <83ehuy698u.fsf@gnu.org> <8362ga5h7h.fsf@gnu.org> <87r4ywpnv0.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: dough.gmane.org 1326994564 11892 80.91.229.12 (19 Jan 2012 17:36:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 19 Jan 2012 17:36:04 +0000 (UTC) Cc: 10474@debbugs.gnu.org, commander.sirow@googlemail.com To: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Thu Jan 19 18:35:59 2012 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Rnvu2-00070v-Ji for guile-bugs@m.gmane.org; Thu, 19 Jan 2012 18:35:58 +0100 Original-Received: from localhost ([::1]:56812 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rnvu2-00088q-5M for guile-bugs@m.gmane.org; Thu, 19 Jan 2012 12:35:58 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:40836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rnvtv-00087o-Ml for bug-guile@gnu.org; Thu, 19 Jan 2012 12:35:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rnvtt-0004aP-OS for bug-guile@gnu.org; Thu, 19 Jan 2012 12:35:51 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40946) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rnvtt-0004aK-Mj for bug-guile@gnu.org; Thu, 19 Jan 2012 12:35:49 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Rnvv3-0007Hf-L4 for bug-guile@gnu.org; Thu, 19 Jan 2012 12:37:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 19 Jan 2012 17:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10474 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 10474-submit@debbugs.gnu.org id=B10474.132699458927946 (code B ref 10474); Thu, 19 Jan 2012 17:37:01 +0000 Original-Received: (at 10474) by debbugs.gnu.org; 19 Jan 2012 17:36:29 +0000 Original-Received: from localhost ([127.0.0.1]:35619 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RnvuW-0007Gg-Fa for submit@debbugs.gnu.org; Thu, 19 Jan 2012 12:36:29 -0500 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:54915) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RnvuT-0007GR-NB for 10474@debbugs.gnu.org; Thu, 19 Jan 2012 12:36:27 -0500 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LY2002003HS6B00@a-mtaout22.012.net.il> for 10474@debbugs.gnu.org; Thu, 19 Jan 2012 19:35:07 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([84.229.115.9]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LY2001X43IG5TD0@a-mtaout22.012.net.il>; Thu, 19 Jan 2012 19:35:07 +0200 (IST) In-reply-to: <87r4ywpnv0.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:6063 Archived-At: > From: ludo@gnu.org (Ludovic Court=C3=A8s) > Cc: 10474@debbugs.gnu.org, wingo@pobox.com, commander.sirow@googlem= ail.com > Date: Thu, 19 Jan 2012 00:55:31 +0100 >=20 > Can you send this one to bug-gnulib@gnu.org? (All the code under l= ib/ > comes from Gnulib.) For the record, my report to bug-gnulib is here: http://lists.gnu.org/archive/html/bug-gnulib/2012-01/msg00253.html > (The rest of your investigation is interesting!) Here's some more ;-) In the last episode, we stopped here: GUILEC ice-9/psyntax-pp.go Throw without catch before boot: Throw to key system-error with args ("make_objcode_from_file" "~= A" ("No error") (0))Aborting. It turns out that this happens because Guile reads and writes objcode= s =66rom/to *.go files in text mode. My solution was to use binary mod= e in writing in mkstemp.c: fd =3D open (template, O_RDWR|O_BINARY|O_CREAT|O_EXCL, 0600); and in reading in objcodes.c:load-objcode: fd =3D open (c_file, O_RDONLY | O_BINARY | O_CLOEXEC); While the latter change looks as TRT in all cases, the former does not: there's no guarantee that mkstemp! will be used only for outputting *.go files. It is probably best to have a wrapper around mkstemp!, and use only that for writing to *.go files in compile.scm. Next obstacle: Abort while compiling ice-9/poll.scm: In ice-9/eval.scm: 389: 19 [eval # #] 350: 18 [eval # #] 434: 17 [lp (#) ("")] In system/base/compile.scm: 148: 16 [compile-file "ice-9/poll.scm" #:output-file ...] 43: 15 [call-once #] In ice-9/boot-9.scm: 184: 14 [with-throw-handler #t ...] In system/base/compile.scm: 59: 13 [#] 151: 12 [# #] 200: 11 [read-and-compile # #:from ...= ] 212: 10 [lp (#) # #] 178: 9 [lp (#) (eval-when= # #) ...] In ice-9/boot-9.scm: 2095: 8 [save-module-excursion #] In language/scheme/compile-tree-il.scm: 31: 7 [#] In ./ice-9/psyntax.scm: 1011: 6 [chi-top-sequence ((eval-when # #)) () ((top)) ...] 898: 5 [scan ((eval-when # #)) () ((top)) ...] 269: 4 [scan ((load-extension # "scm_init_poll")) () ((top)) ..= .] In unknown file: =09?: 3 [load-extension "libguile-2.0" "scm_init_poll"] In ice-9/boot-9.scm: 115: 2 [# misc-error ...] In unknown file: =09?: 1 [delete-file "ice-9/poll.go.LORZMf"] In ice-9/boot-9.scm: 119: 0 [# system-error ...] ice-9/boot-9.scm:119:20: In procedure #: ice-9/boot-9.scm:119:20: In procedure delete-file: Permission de= nied make[2]: *** [ice-9/poll.go] Error 1 This happens because poll.scm does this: (eval-when (eval load compile) (load-extension (string-append "libguile-" (effective-version)= ) =09=09 "scm_init_poll")) while scm_init_poll has this snippet: static void scm_init_poll (void) { #if HAVE_POLL scm_c_define_gsubr ("primitive-poll", 4, 0, 0, scm_primitive_p= oll); #else scm_misc_error ("%init-poll", "`poll' unavailable on this plat= form", SCM_EOL); #endif Since Windows doesn't HAVE_POLL, scm_misc_error throws an error. It doesn't sound wise to fail the entire build procedure due to `poll= ' being unavailable (AFAIK, not only MS-Windows lacks that library function). Maybe poll.scm should be compiled, or maybe it should do some clever tricks around load-extension to avoid throwing an error a= t compile time. I'm not a Guile or Scheme person, so I cannot suggest = a good solution. As a workaround, I used "make -k" to allow the build to continue past this point. There's another problem in the above backtrace: The form that catches the thrown error cannot delete the temporary file ice-9/poll.go.LORZMf, because it tries to delete a file that is still open. Changing call-with-output-file/atomic to close the temporary file before deletion, like this: (define* (call-with-output-file/atomic filename proc #:optional = reference) (let* ((template (string-append filename ".XXXXXX")) =09 (tmp (mkstemp! template))) =09 (call-once =09 (lambda () =09 (with-throw-handler #t =09 (lambda () =09=09(proc tmp) =09=09(chmod tmp (logand #o0666 (lognot (umask)))) =09=09(close-port tmp) =09=09(rename-file template filename)) =09 (lambda args =09=09(close-port tmp) ;; <<<<<<<<<<<<<<<<<<<<<<<<<<< =09=09(delete-file template))))))) solves the problem, and we can now see the correct backtrace: Backtrace: In ice-9/eval.scm: 389: 19 [eval # #] 350: 18 [eval # #] 389: 17 [eval # #] 350: 16 [eval # #] 434: 15 [lp (#) ("")] In system/base/compile.scm: 149: 14 [compile-file "ice-9/poll.scm" #:output-file ...] 43: 13 [call-once #] In ice-9/boot-9.scm: 184: 12 [with-throw-handler #t ...] In system/base/compile.scm: 59: 11 [#] 152: 10 [# #] 201: 9 [read-and-compile # #:from ...] 213: 8 [lp (#) # #] 179: 7 [lp (#) (eval-when= # #) ...] In ice-9/boot-9.scm: 2095: 6 [save-module-excursion #] In language/scheme/compile-tree-il.scm: 31: 5 [#] In ./ice-9/psyntax.scm: 1011: 4 [chi-top-sequence ((eval-when # #)) () ((top)) ...] 898: 3 [scan ((eval-when # #)) () ((top)) ...] 269: 2 [scan ((load-extension # "scm_init_poll")) () ((top)) ..= .] In unknown file: =09?: 1 [load-extension "libguile-2.0" "scm_init_poll"] In ice-9/boot-9.scm: 119: 0 [# misc-error ...] ice-9/boot-9.scm:119:20: In procedure #: ice-9/boot-9.scm:119:20: In procedure %init-poll: `poll' unavail= able on this platform The build still stops, but now we have a human-readable description o= f the reason. The problem in poll.scm causes another failure while compiling web/server/http.scm: GUILEC web/server/http.go Backtrace: In system/base/compile.scm: 152: 19 [# #] 201: 18 [read-and-compile # #:fro= m ...] 213: 17 [lp () #f #] 179: 16 [lp (#) (define-m= odule # # ...) ...] In ice-9/boot-9.scm: 2095: 15 [save-module-excursion #] In language/scheme/compile-tree-il.scm: 31: 14 [#] In ./ice-9/psyntax.scm: 1011: 13 [chi-top-sequence ((define-module # # # ...)) () ((top)= ) ...] 898: 12 [scan ((define-module (web server http) #:use-module ..= .)) () ...] 269: 11 [scan ((#(syntax-object let # ...) (#) (# #) ...)) () .= ..] In ice-9/eval.scm: 374: 10 [eval # ()] In ice-9/boot-9.scm: 2651: 9 [define-module* (web server http) #:filename ...] 2626: 8 [resolve-imports ((# # #) (#) (#) (#) ...)] 2564: 7 [resolve-interface (ice-9 poll) #:select ...] 2489: 6 [# # ...] 2756: 5 [try-module-autoload (ice-9 poll) #f] 2095: 4 [save-module-excursion #] 2767: 3 [#] In unknown file: =09?: 2 [primitive-load-path "ice-9/poll" #f] =09?: 1 [load-extension "libguile-2.0" "scm_init_poll"] In ice-9/boot-9.scm: 119: 0 [# misc-error ...] ice-9/boot-9.scm:119:20: In procedure #: ice-9/boot-9.scm:119:20: In procedure %init-poll: `poll' unavail= able on this platform make[2]: *** [web/server/http.go] Error 1 Other than that, the build finally succeeds! P.S. I found a couple of other possible places that don't support Windows file names: ice-9/boot-9.scm: (define* (load-in-vicinity dir path #:optional reader) (define (canonical->suffix canon) =09 (cond =09 ((string-prefix? "/" canon) canon) =09 ((and (> (string-length canon) 2) =09=09(eqv? (string-ref canon 1) #\:)) =09 ;; Paths like C:... transform to /C... =09 (string-append "/" (substring canon 0 1) (substring canon 2))) =09 (else canon))) system/base/compile.scm: (define (canonical->suffix canon) =09 (cond =09 ((string-prefix? "/" canon) canon) =09 ((and (> (string-length canon) 2) =09=09(eqv? (string-ref canon 1) #\:)) =09 ;; Paths like C:... transform to /C... =09 (string-append "/" (substring canon 0 1) (substring canon 2))) =09 (else canon))) I don't understand the "Paths like C:... transform to /C..." part. Does that assume Cygwin? Because the "transformed" file names will not work in the native Windows build, which is what MinGW produces. P.P.S. I have still a few non-fatal warnings to investigate and perhaps report, if they turn out to be real problems. And then there's a test suite. Stay tuned.