Building and Installing¶
This document describes how to obtain the contracts-enabled Clang compiler.
Installing using Compiler Explorer¶
The easiest way to get started is to use the pre-built nightly binaries via the Compiler Explorer infrastructure package.
Clone the Compiler Explorer infra repository:
git clone https://github.com/compiler-explorer/infra
cd infra
Then build the ‘ce_install’ binary:
make ce
Now you should have ./bin/ce_install which you can use it to install the contracts-enabled Clang compiler:
./bin/ce_install --enable nightly install compilers/c++/nightly/clang ericwf-contracts-trunk
The compiler will be installed in the infra installation directory, typically under /opt/compiler-explorer/.
See https://github.com/compiler-explorer/infra/blob/main/docs/installing_compilers.md for further information about installing from compiler explorer.
Building from Source¶
You can build the Clang contracts branch from source like any other Clang branch. Please see the Clang documentation for more information.
The basic steps are:
Clone the LLVM project repository with the contracts branch:
git clone https://github.com/efcs/llvm-project.git
cd llvm-project
git checkout contracts-nightly
Configure the build with CMake, enabling Clang and the C++ runtime libraries:
mkdir build
cd build
cmake -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="clang" \
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
../llvm
Build as you would any Clang build.