Building Software Security Analysis Repo from scratch Python - SVF-tools/Software-Security-Analysis GitHub Wiki
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. Windows Subsystem for Linux might do as well.
1 - Install Packages
Ubuntu/Debian
Install CMake through your package manager. Some possibilities (these commands may require use of sudo):
- Debian and Ubuntu based systems
$ 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
MacOS
- 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 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. You can use your python interpreter to run test.py under these folders.
We highly recommend you to use VSCode or PyCharm, please refer to VSCode IDE for Python or PyCharm IDE