Skip to main content

Prerequisites

Before building MiniSat, ensure you have the following installed:
  • C++ compiler with C++11 support (GCC 4.8+, Clang 3.4+, or MSVC 2015+)
  • GNU Make or CMake (version 2.6 or higher)
  • zlib development library
sudo apt-get update
sudo apt-get install build-essential zlib1g-dev

Building with Make

MiniSat uses a flexible Makefile-based build system with multiple configuration options.

Quick installation

The simplest approach uses GNU standard locations with a prefix:
1

Configure the installation prefix

cd minisat
make config prefix=/usr/local
Replace /usr/local with your preferred installation directory.
2

Build and install

make install
This builds the release version and installs binaries, libraries, and headers.
You can combine multiple configuration options in a single command:
make config prefix=$HOME/.local BUILD_DIR=build/release

Build targets

MiniSat provides multiple build configurations:
make r    # Release binary (minisat)
make cr   # Core solver binary (minisat_core)
make lr   # Static library (libminisat.a)
make lsh  # Shared library (libminisat.so)
Release builds are optimized with -O3 -DNDEBUG flags.
The default make all target builds the release binary, static library, and shared library.

Configuration options

Customize the build by modifying these variables:
VariableDefaultDescription
BUILD_DIRbuildDirectory for object files and binaries
MINISAT_REL-O3 -DNDEBUGRelease build flags
MINISAT_DEB-O0 -DDEBUGDebug build flags
MINISAT_RELSYM-gInclude debug symbols in release
prefix/usr/localInstallation root directory
includedir$(prefix)/includeHeader installation directory
bindir$(prefix)/binBinary installation directory
libdir$(prefix)/libLibrary installation directory
The configuration is stored in config.mk. To reset to defaults, run:
make distclean

Installing specific components

You can install individual components:
make install-headers  # Install header files only
make install-lib      # Install libraries only
make install-bin      # Install binaries only
make install-debug    # Install debug libraries and headers

Building with CMake

CMake provides a cross-platform alternative to Make:
1

Create a build directory

cd minisat
mkdir build && cd build
2

Configure with CMake

cmake ..
Or specify options:
cmake -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_INSTALL_PREFIX=/usr/local \
      -DSTATIC_BINARIES=ON \
      ..
3

Build the project

cmake --build .
Or use make directly:
make -j$(nproc)
4

Install (optional)

sudo cmake --install .
Or:
sudo make install

CMake options

OptionDefaultDescription
CMAKE_BUILD_TYPEReleaseBuild type: Release, Debug, RelWithDebInfo
STATIC_BINARIESONLink binaries statically
USE_SORELEASEONUse SORELEASE in shared library filename
CMAKE_INSTALL_PREFIX/usr/localInstallation prefix
cmake -DCMAKE_BUILD_TYPE=Release ..

Build artifacts

After building, you’ll find:

Executables

  • minisat or minisat_simp: Full solver with preprocessing
    • Location (Make): build/release/bin/minisat
    • Location (CMake): build/minisat_simp
  • minisat_core: Core solver without simplification
    • Location (Make): build/release/bin/minisat_core
    • Location (CMake): build/minisat_core

Libraries

  • Static library: libminisat.a
    • Location (Make): build/release/lib/libminisat.a
    • Location (CMake): build/libminisat.a
  • Shared library: libminisat.so.2.1.0 (Linux) or libminisat.dylib (macOS)
    • Location (Make): build/dynamic/lib/
    • Location (CMake): build/

Headers

Installed to $(includedir)/minisat/ with the following structure:
minisat/
├── core/
│   ├── Solver.h
│   ├── SolverTypes.h
│   └── Dimacs.h
├── simp/
│   └── SimpSolver.h
├── mtl/
│   ├── Vec.h
│   ├── Heap.h
│   ├── Map.h
│   └── ...
└── utils/
    ├── Options.h
    ├── System.h
    └── ParseUtils.h

Verifying the installation

Test your installation:
1

Check the binary

minisat --help
You should see usage information and available options.
2

Test with a simple CNF file

Create a test CNF file test.cnf:
p cnf 3 2
1 -3 0
2 3 -1 0
Run the solver:
minisat test.cnf result.txt
Check the result:
cat result.txt
If you installed to a non-standard prefix, you may need to update your environment:
export PATH=$PREFIX/bin:$PATH
export LD_LIBRARY_PATH=$PREFIX/lib:$LD_LIBRARY_PATH
export CPLUS_INCLUDE_PATH=$PREFIX/include:$CPLUS_INCLUDE_PATH

Cleaning build files

make clean      # Remove build artifacts
make distclean  # Remove build artifacts and config.mk

Troubleshooting

Install the zlib development package:
# Ubuntu/Debian
sudo apt-get install zlib1g-dev

# Fedora/RHEL
sudo dnf install zlib-devel

# macOS
brew install zlib
Install a C++ compiler:
# Ubuntu/Debian
sudo apt-get install build-essential

# Fedora/RHEL
sudo dnf groupinstall "Development Tools"

# macOS
xcode-select --install
Use sudo for system-wide installation or choose a user-writable prefix:
make config prefix=$HOME/.local
make install
Update your library path:
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
Or add to /etc/ld.so.conf.d/ and run sudo ldconfig.

Next steps

Quick start guide

Learn how to use MiniSat to solve SAT problems in C++

Build docs developers (and LLMs) love