Building Sapo - sapotools/sapo GitHub Wiki

In order to compile libSapo, the following packages are mandatory:

  • a C++17-compatible compiler
  • cmake (version >= 3.6)
  • make

In addition to the above-mentioned packages, compiling the stand-alone application sapo requires the following software:

  • Flex (version >= 2.6.3)
  • Bison (version >= 3.6)

Compiling libSapo and sapo

The Sapo source code can be obtained by cloning its GitHub repository:

git clone

At the end of the command execution the current directory will include a subdirectory, named sapo, containing the Sapo source code.

Once all the required packages have been installed, build both libSapo and sapo by using the following commands:

cd sapo
cmake .

This command generates both the dynamic and the static versions of libSapo and, whenever the requirements are met, produces the executable ./sapo/bin/sapo.

The stand-alone application supports multi-threading even though it only runs one thread by default.

If you prefer to compile plain sequential code, then replace the last two lines of above instructions by



In order to test whether Sapo is properly working in your system, please call from the command line:

make test

Installing the tool

In order to install libSapo and, possibly, sapo system-wise use the command:

make install

The default install directory is /usr/local/. The stand-alone application will be placed in <INSTALL_DIRECTORY}>/bin, the library in <INSTALL_DIRECTORY>/lib, and its header files in <INSTALL_DIRECTORY>/include.

To change the default install directory execute:

make install

where <INSTALL_DIRECTORY> must be replaced by the aimed installed directory, e.g., /usr or ./.