Getting Started
This page covers everything needed to build Lotus from source and run your first analysis. It describes the required dependencies, CMake configuration options, build steps, and a quick-start example invoking a checker against a compiled bitcode file.
System Requirements
Lotus has been tested on x86/ARM Linux and ARM macOS. The following dependencies are required before building.
Dependency |
Required Version |
Notes |
|---|---|---|
LLVM |
14.x |
Must match exactly; the build system searches for it automatically. |
Z3 |
4.11 |
SMT solver; found via |
CMake |
3.18+ |
Build system generator. |
C++ compiler |
C++17 compatible |
GCC or Clang with |
Boost |
1.65+ (optional) |
Only required when |
Build Instructions
The standard workflow to build Lotus is to create an out-of-source build directory and invoke CMake.
git clone https://github.com/ZJU-PL/lotus.git
cd lotus
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
If your LLVM installation is not in a standard system path, provide it to CMake:
cmake .. -DLLVM_BUILD_PATH=/path/to/llvm/lib/cmake/llvm
To run the unit test suite (recommended after building), configure with
-DLOTUS_BUILD_TESTS=ON first; tests are off by default:
cmake .. -DLOTUS_BUILD_TESTS=ON
make -j$(nproc)
make test
# Or using ctest:
ctest --output-on-failure
Quick-Start Example
The standard workflow for running a Lotus checker on C/C++ code is:
Compile the target program to LLVM bitcode using
clangwith-emit-llvm.Run a Lotus checker tool (from
build/bin/) on the.bcfile.
# 1. Compile C code to LLVM bitcode
clang -g -emit-llvm -c example.c -o example.bc
# 2. Run an alias analysis pass
./build/bin/lotus-alias-sparrow-aa example.bc
# 3. Run a bug-finding checker (e.g., Use-After-Free & Leak checking)
./build/bin/lotus-check --engine=saber example.bc
Command-Line Tools Reference
Lotus exposes its internal libraries through standalone executable drivers in build/bin/.
Tool Binary |
Source Directory |
Typical Invocation |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
For detailed instructions on extending Lotus or adding new analysis passes, see the developer documentation.