libGAP /

Filename Size Date modified Message
310 B
287 B
106 B
18.1 KB
0 B
15.8 KB
525 B
25.6 KB
0 B
3.4 KB
282 B
43.1 KB
42.9 KB
36.0 KB
495.2 KB
6.3 KB
23.6 KB
14.7 KB
324.1 KB
6.9 KB
4.6 KB

A C library version of the GAP kernel.

GAP ( is a system for computational group
theory. This repo contains a shared library version of the GAP kernel,
allowing you to directly talk to GAP from your own C/C++ code.

Much of the group theory in SageMath ( is
implemented using LibGAP.


  * the GAP library (scripts in the GAP language)
  * GMP/MPIR shared library

  * GMP/MPIR headers

Packaging (to run "make dist"):
  * Python
  * The Python PLY module (


The current tarball can be found at

  * Always use the libgap-x.y.z.tar.gz tarball (the output of "make
    dist"), and not the files in the repository. Only the former has
    its symbols transforrmed with the "libGAP_" prefix.

  * For the testsuite, you need to have the gap library installed
    somewhere. Configure/make libGAP with
    -DSYS_DEFAULT_PATHS=<gap_root> cflags tests, where the path has be
    quoted such that it ends up with quotation marks in C sources:

        $ ./configure CFLAGS='-DSYS_DEFAULT_PATHS=\"/path/to/gap\"'

        $ export CFLAGS='-DSYS_DEFAULT_PATHS=\"/home/vbraun/Sage/git/local/gap/latest\"'
        $ ./configure
        $ make check
    For example, using the GAP installation in SageMath:

        $ ./configure CFLAGS='-DSYS_DEFAULT_PATHS=\"$SAGE_ROOT/local/gap/latest\"'


LibGAP aims to track the upstream GAP development as close as
possible. To update LibGAP-x.y.z to a new GAP-x.y.(z+1) release, use
the following steps:

  1. Copy the previous and new GAP src directory to upstream-gap-x.y.z
     and upstream-gap-x.y.(z+1), respectively.

  2. Run scripts/, which will generate

  3. Replace the C sources in LibGAP's src with the new

         cp upstream/src/*.[c,h] src/

  4. Apply patches/gap-x.y.z.patch to the new src
     directory. Hopefully, there are no conflicts. Good luck!

         $ cd src && patch -p1 < ../patches/gap-x.y.z.patch

  5. Update src/ if C sources have been added/removed.

  6. Update the version in src/

  7. Update the version in and run

         $ autoreconf -fiv

  8. Run "make distcheck" (the testsuite will fail because it does not
     pass CFLAGS, ignore).

The tests use unescaped GAP symbols since it's easier to develop. The
test/ dist-hook rewrites them with the libGAP_ prefix. If
you change tests make sure to update the dist-hook in with any new GAP
symbols that you use.

For debugging you should probably build GAP

    $ ./configure CFLAGS='-O0 -g3'    # standalone GAP
    $ SAGE_DEBUG=yes ./sage -f gap   # inside SageMath

LibGAP with debug symbols:



See SageMath, and in particular $SAGE_ROOT/sage/libs/gap/, for real-world
usage of LibGAP. SageMath contains a Cython interface to LibGAP if you are
so inclined.

Talk about LibGAP:

  * Slides:

  * Video: