Building Gambit from source#

This page covers instructions for building Gambit from source. This is for those who are interested in developing Gambit, or who want to play around with the latest features before they make it into a pre-compiled binary version.

This page requires at least some familiarity with programming. Most users will want to stick with released distributions; see the Install page for how to get the current version for your operating system. Following the instructions here will install the Gambit CLI, GUI and Python extension (PyGambit).

The steps you will need to follow to build from source are as follows:

  1. Refer to the contributor page which explains how to clone the Gambit repository from GitHub (you may first wish to create a fork).

  2. Install the necessary build tools and dependencies for your platform.

  3. Follow the platform-specific instructions to build and install Gambit CLI and GUI components from source.

  4. Build the Python extension (PyGambit).

Install build tools and dependencies#

Install on macOS via Homebrew
  1. Check that you have Homebrew installed by running brew –version. If not, follow the instructions at https://brew.sh/.

  2. Install build dependencies:

    brew install automake autoconf libtool wxwidgets
    

    Note

    If you encounter interpreter errors with autom4te, you may need to ensure your Perl installation is correct or reinstall the autotools:

    brew reinstall automake autoconf libtool wxwidgets
    
Install on Linux (Debian/Ubuntu) via apt
  1. Update your package lists:

    sudo apt update
    
  2. Install general build dependencies:

    sudo apt install build-essential automake autoconf libtool
    
  3. Install GUI dependencies:

    sudo apt install libwxgtk3.2-dev
    
Install on Windows

The recommended way to build Gambit on modern Windows is to use the MSYS2 / MinGW-w64 environment.

  1. Download and install MSYS2 from https://www.msys2.org/ and follow the update instructions there (you will typically run pacman -Syu and restart the MSYS2 terminal as instructed).

  2. Open the “MSYS2 MinGW 64-bit” terminal (important: use the MinGW shell, not the plain MSYS shell).

  3. Install general build dependencies

    # update package DB & core packages first (may require closing/reopening the shell)
    pacman -Syu
    
    # install compiler toolchain, autotools and libtool
    pacman -S --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-automake \
    mingw-w64-x86_64-autoconf mingw-w64-x86_64-libtool mingw-w64-x86_64-make
    
  4. Install GUI dependencies

    pacman -S --needed mingw-w64-x86_64-wxwidgets3.2
    

Note

When building for a different target (32-bit) substitute the corresponding MinGW packages (mingw-w64-i686-*).

Install CLI and GUI from source#

Navigate to the Gambit source directory (use the “MSYS2 MinGW 64-bit” terminal on Windows) and run:

aclocal
libtoolize
automake --add-missing
autoconf
./configure
make
# Skip this on Windows:
sudo make install
Build macOS application bundle
  1. Create macOS application bundle:

    To create a distributable DMG file:

    make osx-dmg
    
  2. Install the application:

    After creating the DMG file, open it and drag the Gambit application to your Applications folder.

Creating a Windows installer
  1. Create a .msi installer. This requires the Wix toolset.

    make msw-msi
    
  2. Install the application:

    Run the generated gambit-X.Y.Z.msi file to install Gambit on your system.

Note

Command-line options are available to modify the configuration process; do ./configure –help for information. Of these, the option which may be most useful is to disable the build of the graphical interface.

By default Gambit will be installed in /usr/local. You can change this by replacing configure step with one of the form

./configure --prefix=/your/path/here

Note

If you don’t want to build the graphical interface, you can pass the argument --disable-gui to the configure step, for example:

./configure --disable-gui

Warning

If wxWidgets isn’t installed in a standard place (e.g., /usr or /usr/local), you’ll need to tell configure where to find it with the --with-wx-prefix=PREFIX option, for example:

./configure --with-wx-prefix=/home/mylogin/wx

Warning

The graphical interface relies on external calls to other programs built in this process, especially for the computation of equilibria. It is strongly recommended that you install the Gambit executables to a directory in your path!

Building the Python extension#

The pygambit Python package is in src/pygambit in the Gambit source tree. We recommend to install pygambit as part of a virtual environment rather than in the system’s Python (for example using venv). Use pip to install from the root directory of the source tree:

python -m venv venv
source venv/bin/activate
python -m pip install .

Once installed, simply import pygambit in your Python shell or script to get started.