[gambit-list] building git master fails

Marc Feeley feeley at iro.umontreal.ca
Mon May 31 11:21:22 EDT 2021


Hi Jörg.  Unfortunately those steps are not correct to build the latest Gambit.  I’ll interleave my comments with your message.

> On May 31, 2021, at 8:16 AM, Jörg F. Wittenberger <Joerg.Wittenberger at softeyes.net> wrote:
> 
> trying to build the master branch from githug fails
> 
> I followed the steps from INSTALL.txt section 1 §2
> (wget ...gambit-4_9_3-devel.tar.gz et.c) followed
> 
> ./configure --enable-single-host --prefix=~/test
> 
> make
> 

At this point you have a gsc/gsc that is the Gambit compiler at release 4.9.3 .  No more no less.

> make bootstrap

This step copies gsc/gsc to ./gsc-boot .  It makes it possible to change the .scm files in ./lib or ./gsi or ./gsc and create updated .c files from those modified .scm files by running “make” (which invokes ./gsc-boot for compiling any .scm file).  This is useful, for example, if you change the Gambit runtime library or the way the Gambit compiler works.

This is a nice state to be in to develop Gambit (but starting at the release 4.9.3 not the latest commit).

> 
> git pull

This step gets from github the latest commit of the master branch and in particular these updated files:

1) include/gambit.h.in, from which include/gambit.h is generated by the ./configure script
2) lib/setup.c, lib/os_io.c, etc files, which are hand-written C files of the Gambit runtime library
3) lib/_io.scm, lib/_num.scm, etc files, which are hand-written Scheme files of the Gambit runtime library
4) lib/_io.c, lib/_num.c, etc files which are files generated by some version of the Gambit compiler from lib/_io.scm, lib/_num.scm, etc ***BUT NOT THE ONES IN #3***

It is important to understand that the .c files in #4 are not consistent with the .scm files in #3.  In other words trying to build Gambit with a simple “make” will fail at this point.  To get out of this predicament it is necessary to generate lib/_io.c from lib/_io.scm, etc using the Gambit Scheme compiler.  But the compiler ./gsc-boot is (very probably) not consistent with the current include/gambit.h .  Remember that the Gambit compiler generates C code that contains calls to the macros defined in include/gambit.h so it is important to use a Gambit compiler that is “in sync” with that version of the gambit.h file.  So the most recent version of the Gambit compiler must be built first…

The procedure for doing this bootstrap is part of the github repository and it will be invoked automatically when doing “make” after a “git clone …”.  So all the steps you have done up to now are unnecessary towards the goal of having a build of the latest commit… it is simpler to use the steps suggested in the README:

    git clone https://github.com/gambit/gambit.git
    cd gambit
    ./configure        # --enable-single-host optional but recommended
    make               # build runtime library, gsi and gsc (add -j8 if you can)
    make modules       # compile the builtin modules (optional but recommended)
    make check         # run self tests (optional but recommended)
    make doc           # build the documentation
    sudo make install  # install

If you insist on starting with a “wget …/gambit-v4_9_3-devel.tgz”, untar and “cd gambit-v4_9_3-devel” the correct next step is “git pull” and then continue at the “./configure” step.

Doing a “make” before the “git pull” is OK, but it isn’t a useful step towards having a build of the latest Gambit.  The thing to avoid is to do a “make bootstrap” after the “make” (and before the “git pull”) because that will create a ./gsc-boot that is the Gambit compiler at release 4.9.3 and it will not work for the code that will be obtained by the “git pull”.

Why is Gambit’s build procedure like this?  For most projects on github when you do a “git clone …” the .c files obtained are the most recent source files and whenever you do a “git pull” the new .c files are all “current” and a “make” will work.  The Gambit generated .c files (lib/_io.c, lib/_num.c, etc) could be pushed to the github repository whenever lib/_io.scm. lib/_num.scm, etc are modified.  This policy would avoid the need for the bootstrap step.  However, a small modification of a .scm file usually results in a large number of changes of the generated .c file so this policy would tend to grow the git history much much faster (to the point of becoming impractical to keep it around).  That’s why the policy that is used is to only push the generated .c files when a new release of Gambit is created.  This makes it possible to build releases without a bootstrap step.

I hope this clarifies things!

Marc

> 
> make realclean
> 
> # again:
> ./configure --enable-single-host --prefix=~/test
> 
> make
> 
> ----
> 
> The resulting ___CHARALPHABETICP being undefined I solved by adding a
> line to config.h.in:
> 
> #define ___USE_C_RTS_CHAR_OPERATIONS
> 
> But the "Ill-placed 'declare'" in _num.scm line 5525 is above my head.
> Looks an issue with `define-prim&proc` -- but I don't understand it.
> 
> Any help appreciated.
> 
> best
> 
> Jörg
> 
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://mailman.iro.umontreal.ca/cgi-bin/mailman/listinfo/gambit-list




More information about the Gambit-list mailing list