Soufflé is a powerful Datalog engine designed for scalable static analysis and declarative logic programming. It is widely used for program analysis, security analysis, and other domains requiring high-performance logical inference. This guide will walk you through the step-by-step process of building Soufflé from source on a Linux-based system.
Prerequisites
Before building Soufflé, ensure that your system meets the necessary dependencies and requirements.
System Requirements
- A Linux system (Ubuntu, Debian, Fedora, or similar)
- At least 2GB of RAM (more recommended for large analyses)
- Sufficient disk space (~1GB recommended)
Dependencies
Install the required dependencies using your system’s package manager:
Ubuntu/Debian:
sudo apt update && sudo apt install -y \
build-essential cmake clang llvm libncurses5-dev \
libffi-dev libgmp-dev zlib1g-dev liblzma-dev \
libsqlite3-dev libtinfo-dev flex bison
Fedora:
sudo dnf install -y \
gcc-c++ cmake clang llvm ncurses-devel \
libffi-devel gmp-devel zlib-devel \
xz-devel sqlite-devel flex bison
Cloning the Repository
Clone the Soufflé source code from its GitHub repository:
git clone https://github.com/souffle-lang/souffle.git
cd souffle
Building Soufflé
Once you have the source code, follow these steps to compile and install Soufflé.
Step 1: Configure the Build
Use CMake to configure the build process:
cmake ..
Step 2: Make configuration options (Optional)
You can enable specific features using additional flags:
-DSOUFFLE_DOMAIN_64BIT=ON
– Enable 64-bit domain (useful for large datasets)-DSOUFFLE_PROFILE=ON
– Enable profiling support-DSOUFFLE_SQL=ON
– Enable SQLite support
You can find all available options by exploring the source code in souffle/CMakeLists.txt
. The table below highlights the most relevant options.
To specify build options, use the following command:
cmake -S . -B build -D<option>=<value>
Alternatively, you can launch CMake’s terminal GUI for interactive configuration:
cmake build
Option | Default | Description |
---|---|---|
CMAKE_BUILD_TYPE | Release | Release , Debug |
SOUFFLE_DOMAIN_64BIT | OFF | Support 64-bit integer and float values in Datalog tuples instead of default’s 32-bit |
SOUFFLE_SWIG | OFF | Support all SWIG builds |
SOUFFLE_SWIG_JAVA | OFF | Support Java SWIG build |
SOUFFLE_SWIG_PYTHON | OFF | Support Python SWIG build |
SOUFFLE_USE_CURSES | ON | Support terminal-UI-based provenance display |
SOUFFLE_USE_LIBFFI | ON | Support C++ functors with an arbitrary number of arguments. When OFF limitations applies on the number of arguments in C++ functors supported by the interpreter engine, see StatelessFunctorMaxArity and CALL_STATEFULL in source code. |
SOUFFLE_USE_OPENMP | ON | Support parallel evaluation with OpenMP |
SOUFFLE_USE_SQLITE | ON | Support SQLite I/Os |
SOUFFLE_USE_ZLIB | ON | Support compress file I/Os |
SOUFFLE_SANITISE_MEMORY | OFF | Build with memory sanitizer |
SOUFFLE_SANITISE_THREAD | OFF | Build with thread sanitizer |
For example:
cmake .. -DSOUFFLE_DOMAIN_64BIT=ON -DSOUFFLE_PROFILE=ON
Step 3: Compile the Source Code
Compile Soufflé using:
make -j$(nproc)
This will build Soufflé in parallel using the maximum available CPU cores.
Step 4: Install Soufflé
To install Soufflé on your system, specify the installation directory using the -DCMAKE_INSTALL_PREFIX=<install-dir>
option. The executable, scripts, and header files will be placed in <install-dir>
. Be sure to use an absolute path for <install-dir>
.
Run the following commands to install Soufflé:
cd souffle
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=<install-dir>
cmake --build build --target install
After installation, add Soufflé to your system’s PATH
so that the commands souffle
and souffleprof
are available:
export PATH=$PATH:<install-dir>/bin
Verifying the Installation
Check if Soufflé is installed correctly:
souffle --version
If you see output similar to:
Souffle: Version 2.3.1
Soufflé has been successfully built and installed.
Running a Simple Datalog Program
Let’s test Soufflé with a simple example.
Create a file example.dl
:
.decl edge(x: symbol, y: symbol)
.decl path(x: symbol, y: symbol)
input edge
output path
path(x, y) :- edge(x, y).
path(x, z) :- edge(x, y), path(y, z).
Create an input file edge.facts
:
e1 e2
e2 e3
e3 e4
Run Soufflé:
souffle example.dl
This will generate an output file path.csv
containing the inferred paths.
Conclusion
Building the Soufflé Datalog engine is straightforward with proper dependencies and tools. Once installed, it can be used for a wide range of logic programming and static analysis tasks. With its high-performance implementation, Soufflé is a great choice for anyone looking to perform large-scale declarative analysis efficiently.
- Roblox Force Trello - February 25, 2025
- 20 Best Unblocked Games in 2025 - February 25, 2025
- How to Use Java Records to Model Immutable Data - February 20, 2025