LLVM¶
Description¶
The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. It includes compilers, debuggers, libraries and much more.
User instructions¶
llvm (including the clang and clang++ compilers) is available via the modules system. To add it to your environment run:
$ module load llvm/4.0.1
Note that the llvm module includes the clang and clang++ compilers and the lldb debugger.
Source¶
www.llvm.org
License¶
UIUC (BSD-style)
Admin notes¶
The complete build takes a while and including everything in the right place is a little complicated. So I wrote a script to do everything necessary based on the guide at http://clang.llvm.org. Note swig and libxml2-dev must be installed. Note also the build requires several tens of GB of space.
#!/bin/bash
llvm_release=4.0.1
install_dir="/common/debian/9.1/Core/llvm/llvm-${llvm_release}"
tools="cfe lld lldb polly clang-tools-extra"
projects="compiler-rt libcxx libcxxabi libunwind openmp test-suite"
packages="llvm ${tools} ${projects}"
# Download source files
for package in ${packages}; do
if [ ! -f "${package}-${llvm_release}.src.tar.xz" ]; then
wget http://releases.llvm.org/${llvm_release}/${package}-${llvm_release}.src.tar.xz
if [ ! -f "${package}-${llvm_release}.src.tar.xz" ]; then
echo Error downloading.
exit 1
fi
fi
done
# unpack base
tar -xf llvm-${llvm_release}.src.tar.xz
# upack tools
cd llvm-${llvm_release}.src/tools
for tool in ${tools}; do
tar --transform "s/-${llvm_release}.src//" -xf ../../${tool}-${llvm_release}.src.tar.xz
done
mv cfe clang
mv clang-tools-extra clang/tools/extra
# unpack projects
cd ../projects
for project in ${projects}; do
tar --transform "s/-${llvm_release}.src//" -xf ../../${project}-${llvm_release}.src.tar.xz
done
# cmake in a build-dir
cd ../../
mkdir "build-${llvm_release}"
cd "build-${llvm_release}"
cmake -DCMAKE_INSTALL_PREFIX=${install_dir} ../llvm-${llvm_release}.src
make
make install