[gambit-list] Building and using Gambit on windows

Bob Coleman bobcolem at yahoo.com
Tue Oct 11 10:21:09 EDT 2016


I've ran into the same issue on windows using msys2 and made the same mistake.  The path passed to configure must be a classic windows path with the drive letter and colon like "C:".  The path separators can be forward or back slashes though.  You can also run into problems in your code when opening files using an absolute path obtained from msys2 (as a commandline argument for example).  I use the procedure below to sanitize any paths that could come from outside my code.
I have not seen the segfault issue, but I discovered the problem when loading/including code and didn't try compiling anything before it was fixed.

;; if running in msys and bash passed in a /c/... absolute path;; instead of C:/ then patch if so gambit can open the path(define (patch-mingw-path path)  (let* ((path path)         (stype (system-type))         (mingw (and (or (memq 'mingw32 stype)                          (memq 'mingw64 stype))                     #t))         (mingw-prefix (and (eq? (string-ref path 0) #\/)                            (eq? (string-ref path 1) #\c)                            (eq? (string-ref path 2) #\/))))    (if (and mingw mingw-prefix)        (begin          (string-set! path 0 #\C)          (string-set! path 1 #\:)))    path))

Regards,Bob
 

    On Monday, October 10, 2016 10:01 PM, Marc Feeley <feeley at iro.umontreal.ca> wrote:
 

 This is just a guess… I haven’t tried it… but the --prefix should use the Windows path (i.e. --prefix=C:\opt\gambit\bld) because on Windows, even with mingw, the Gambit runtime will call the WIN32 CreateFile function to open files and it expects a Windows path.

I don’t understand why gsc would segfault however.  Do you have more details?  Can you try with gdb?

Marc

> On Oct 10, 2016, at 8:57 PM, Bill Six <billsix at gmail.com> wrote:
> 
> I'm unable to figure out how to use Gambit on Windows successfully, and I'd like some help. (I'm plenty comfortable with Gambit on Linux/OSX). My general feeling is that I'm using configure's "prefix" argument incorrectly on Windows, which may be causing my problem.
> 
> I can build gambit just fine using the msys2 environment with mingw64 as the compiler.
> 
> (Here's the head of config.log
> "$ ./configure --prefix=/c/opt/gambit/bld --enable-single-host --enable-gcc-opts")
> 
> I can do basic stuff in gsi, such as
> 
> > (+ 1 2)
> 3
> 
> But the following doesn't work:
> 
> > (include "~~/lib/_gambit#.scm")
> *** ERROR IN (console)@2.1 -- Can't open file "\\c\\opt\\gambit\\bld\\lib/_gambit#.scm"
> 
> and I can't get "gsc -exe foo.scm" (for some trivial foo.scm) to not segfault.
> 
> Any ideas?
> 
> Thanks,
> Bill
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list

_______________________________________________
Gambit-list mailing list
Gambit-list at iro.umontreal.ca
https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list


   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20161011/be3d0e96/attachment.htm>


More information about the Gambit-list mailing list