Skip to content

Building Software Security Analysis Repo from scratch Python

Hanyuan Li edited this page Jun 5, 2026 · 14 revisions

These are instructions for building LLVM, SVF, and the assignments (Software-Security-Analysis) from scratch. This is useful if you like to work with your own editor or terminal or have trouble with Docker, the image, or VSCode (M1 Macs currently do). If you encounter some problem, please check this document Trouble-Shooting-for-IDE.

0 - Pre-requisites

These instructions are for UNIX systems like Linux or macOS. WSL is confirmed to work as well.

1 - Install Packages

Ubuntu/Debian

Install CMake and other dependencies using apt:

$ sudo apt-get update
$ sudo apt-get install -y \
      cmake git gcc g++ nodejs doxygen graphviz lcov libncurses5-dev libtinfo6 libzstd-dev \
      libz-dev zip unzip wget curl xz-utils python3 python3-venv python3-dev patchelf

MacOS

Install dependencies on macOS using Homebrew. If you haven't installed Homebrew, run the following command in your terminal.

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

If Homebrew is installed, run the following commands in your terminal (cmake version >=3.23 is required).

$ brew install cmake git wget xz python

2 - Build SVF-Python

This part is applicable to both Ubuntu/Debian and MacOS. Grab the SVF-Python sources.

git clone https://github.com/SVF-tools/SVF-Python.git
cd SVF-Python

Build. This should take a few minutes. build.sh creates an isolated virtual environment for its build dependencies and uses the current SVF dependency set, including LLVM 21.1.0.

bash build.sh

If you already built SVF from source in a sibling directory, you can reuse it instead of letting SVF-Python/build.sh build SVF again:

export SVF_DIR=/path/to/SVF
export LLVM_DIR=$SVF_DIR/llvm-21.1.0.obj
export Z3_DIR=$SVF_DIR/z3.obj
bash build.sh

Finally, install the generated wheel into the Python environment you use for assignments. A virtual environment is recommended on modern Linux/macOS systems.

python3 -m venv .venv
source .venv/bin/activate
python -m pip install dist/*.whl

3 - Build Software-Security-Analysis

This part is applicable to both Ubuntu/Debian and MacOS. Grab the Software-Security-Analysis sources.

git clone https://github.com/SVF-tools/Software-Security-Analysis
cd Software-Security-Analysis

Congratulations! All built.

4 - Running and debugging your Lab-Exercises, Assignments

Lab Exercise

First install the Jupyter toolkit:

python -m pip install jupyter notebook

And then go to Lab-Exercise-$i/Python folder, $i can be 1, 2 or 3. Then you can see *.ipynb file.

To start Jupyter notebook, you can refer to any Lab Exercise document like Lab-Exercise-1-Python.

Assignments

Python files are under Assignment-$i/Python folder, $i can be 1, 2 or 3. Use your Python interpreter to run the test driver in that folder — test.py for Assignment-1, test-sse.py for Assignment-2, test-ae.py for Assignment-3. Assignment-3's driver takes a .ll file as its argument, for example:

python3 Assignment-3/Python/test-ae.py Assignment-3/Tests/stmt.ll
python3 Assignment-3/Python/test-ae.py Assignment-3/Tests/buf_overflow.ll
python3 Assignment-3/Python/test-ae.py Assignment-3/Tests/null_deref.ll

We highly recommend you to use VSCode or PyCharm, please refer to VSCode IDE for Python or PyCharm IDE

Clone this wiki locally