You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository demonstrates how to use SVF as a library in your project to analyze LLVM bitcode files. We provide examples for three different scenarios of using SVF.
Prerequisites & Dependencies
SVF relies on the following libraries & tools:
CMake (>=3.23)
LLVM (<=16.0.6)
Z3 (>=4.8.8)
Option 1: Build from Scratch
In this scenario, we build SVF from source and use it directly from the build directory.
Step 1: Build SVF
# Clone SVF
git clone https://github.com/SVF-tools/SVF.git
cd SVF
# Build SVF in Release mode
cmake -S ./ -B Release-build
cmake --build Release-build
# Or build SVF in Debug mode
cmake -S ./ -B Debug-build -DCMAKE_BUILD_TYPE=Debug
cmake --build Debug-build
In this scenario, we use SVF installed through npm.
Step 1: Install SVF via npm
npm install svf-lib
Step 2: Build SVF-example
cd SVF-example
# Get npm root directory
NPM_ROOT=$(npm root)# Set SVF_DIR to the SVF installation in npmexport SVF_DIR="$NPM_ROOT/SVF"
cmake -B build -S ./
cmake --build build
Using the Example
After building in any of the above scenarios, you can run the example:
./build/svf-example ./data/example.ll
Troubleshooting
CMake Package Finding
If CMake cannot find SVF, ensure the installation directory is in your CMAKE_PREFIX_PATH:
# For Bash/Zshexport CMAKE_PREFIX_PATH="$SVF_DIR${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH}"# For Fishset -px --path CMAKE_LIBRARY_PATH $SVF_DIR
Library Path Issues
If you encounter library loading issues, ensure the library path is set correctly:
# For Bash/Zshexport LD_LIBRARY_PATH="$SVF_DIR/lib:$LD_LIBRARY_PATH"# For Fishset -Upx LD_LIBRARY_PATH $SVF_DIR/lib
Additional Information
For more detailed information about SVF setup and configuration, please refer to the SVF wiki.
About
An external project example using SVF as a library