sudo apt update
sudo apt install \
clang-15 \
cmake \
curl \
flex \
git \
libboost-dev \
libboost-test-dev \
libfmt-dev \
libgmp-dev \
libjemalloc-dev \
libmpfr-dev \
libunwind-dev \
libyaml-dev \
lld-15 \
llvm-15-tools \
maven \
openjdk-17-jdk \
pkg-config \
python3 \
python3-pip \
xxd
python3 -m pip install pybind11 lit
brew update
brew install \
boost \
cmake \
flex \
fmt \
git \
gmp \
jemalloc \
libyaml \
llvm@15 \
maven \
mpfr \
pkg-config \
python3 \
z3
python3 -m pip install pybind11 lit
Once the system dependencies have been installed, the backend can be built locally with:
git clone https://github.com/runtimeverification/llvm-backend --recursive
cd llvm-backend
mkdir build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=FastBuild \
-DCMAKE_INSTALL_PREFIX=install
make -j$(nproc) install
If you're building on macOS, add the following option to your CMake invocation so that the Homebrew installation of LLVM gets picked up correctly.
-DLLVM_DIR=$($(brew --prefix llvm@15)/bin/llvm-config --cmakedir)
Additionally, to build the pattern-matching compiler, run:
cd matching
mvn package
The backend test suite uses lit
to run a set of integration tests. To
ensure your PATH
variable is set correctly, run:
export PATH=$(pwd)/build/install/bin:$(pwd)/build/bin:$PATH
from the root source directory.
To run the integration tests, run:
lit test
from the root source directory.
There is also a unit test suite for backend internals; Add the following option to your CMake invocation to enable it:
-DBUILD_TESTS=On
run it with:
make test
from the build
directory to run them.
If you are developing the backend, it is useful to also install
clang-format
, include-what-you-use
shellcheck
to ensure that your changes match the project style
and conform to best practices.
# Ubuntu
apt install shellcheck clang-format-12 iwyu
# macOS
brew install shellcheck clang-format iwyu