Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
174 lines (138 sloc) 6.68 KB

Table of Contents


  • a c++14 conforming compiler
    • at least gcc version 4.9
    • clang version 3.1 (using either libstdc++ provided by gcc 4.9 or libc++)
    • at least msvc++ 14.0 (Visual Studio 2015 Update 3)
    • other compilers might work
  • the cmake build system
    • at least version 3.3 is recommended
    • at least version 3.1 is required

Development Dependencies

  • the clingo sourcecode
    • version 5.2 or higher
    • when cloning clingcon via the git repository, the source can be obtained by using git submodule update --init --recursive
  • the bison parser generator
    • at least version 2.5
    • version 3.0 produces harmless warnings (to stay backwards-compatible)
  • the re2c lexer generator
    • version 0.15.3 is used for development
    • the earliest tested version is 0.13.5

Optional Dependencies

  • the Python script language
    • version 2.7 is tested
  • the Lua script language
    • version 5.1 is used for development
    • version 5.2 and 5.3 should work

Build, Install, and Test

When cloning the git repository, do not forget to update the submodules (with source releases, you can skip this step):

git submodule update --init --recursive

To build clingcon in its default configuration in release mode, run:

cmake --build <BUILD_DIR>

The resulting binaries and shared libraries will be in <BUILD_DIR>/bin and are ready to use.

To install all binaries and development files under cmake's install prefix (see the build options), run:

cmake --build <BUILD_DIR> --target install

To run the tests, enable option CLINGCON_BUILD_TESTS (see build options) and run:

cmake --build <BUILD_DIR> --target test

Build Options

To get an overview over the variables that can be set for building clingcon run cmake -B <BUILD_DIR> -LH or cmake -B <BUILD_DIR> -LAH. The latter also prints important cmake specific configuration variables. Options and variables can be passed to cmake on the command line using -D<VARIABLE>=<VALUE> or by editing <BUILD_DIR>/CMakeCache.txt after running cmake.

The build scripts by default try to detect optional dependencies, like Python and Lua scripting support.

Clingcon uses clingo which again uses libpotassco and clasp. All components have their own sets of configuration variables:

In the following, the most important options to control the build are listed.

Generic Options

  • Variable CMAKE_BUILD_TYPE should be set to release.
  • Variable CMAKE_INSTALL_PREFIX controls where to install clingcon.
  • Option CLINGO_BUILD_APPS controls whether to build the application clingcon (Default: ON)
  • Option CLINGCON_BUILD_TESTS controls whether to build the clingcon tests and enable the test target running unit as well as acceptance tests. (Default: OFF)
  • Option CLINGCON_MANAGE_RPATH controls how to find libraries on platforms where this is supported, like Linux, macOS, or BSD but not Windows. This option should be enabled if clingo is installed in a non-default location, like the users home directory; otherwise it has no effect. (Default: ON)

Python Support

With the default configuration, Python support will be auto-detected if the Python development packages are installed.

  • Option CLINGO_BUILD_WITH_PYTHON can be used to enable or disable Python support. (Default: ON)
  • If option CLINGO_REQUIRE_PYTHON is enabled, configuration will fail if no Python support is detected; otherwise, Python support will simply be disabled if not detected. (Default: OFF)
  • If option PYCLINGO_USER_INSTALL is enabled, the clingo Python module is installed in the users home directory; otherwise it is installed in the system's Python library directory. (Default: ON)
  • Variable PYCLINGO_INSTALL_DIR can be used to customize where to install the python module. (Default: automatically detected)

Lua Support

With the default configuration, Lua support will be auto-detected if the Lua development packages are installed.

  • Option CLINGO_BUILD_WITH_LUA can be used to enable or disable Lua support. (Default: ON)
  • If option CLINGO_REQUIRE_LUA is enabled, configuration will fail if no Lua support is detected; otherwise, Lua support will simply be disabled if not detected. (Default: OFF)
  • If variable LUACLINGO_INSTALL_DIR is set, the clingo lua module will be installed there. (Default: not set)


After installing the required packages clingo should compile on most *nixes. If a dependency is missing or a software version too old, then there are typically community repositories that provide the necessary packages. To list a few:

  • the ToolChain repository for Ubuntu 14.04 and earlier (later versions should include all required packages)
  • the Developer Toolset for CentOS
  • the Cygwin project under Windows (re2c must be compiled by hand)
  • both Homebrew and MacPorts provide all the software necessary to compile clingo

And, well, you can compile a recent gcc version yourself. Even on ancient Linux systems. ;)

Notes for Windows Users

clingo can be compiled using the Mingw-w64 compiler, the Cygwin project, or Visual Studio 2015 Update 3. For development, bison from the Win flex-bison project and a self compiled re2c executable can be used.