LLVM installation - ponyatov/orth GitHub Wiki

$ sudo apt install build-essentials cmake 
$ mkdir ~/LLVM ; cd ~/LLVM
$ mkdir gz ; cd gz

sources

$ wget -c \

required

  • llvm http://releases.llvm.org/6.0.0/llvm-6.0.0.src.tar.xz
  • clang http://releases.llvm.org/6.0.0/cfe-6.0.0.src.tar.xz
  • compiler-rt http://releases.llvm.org/6.0.0/compiler-rt-6.0.0.src.tar.xz
# root source tree
$ cd ~/LLVM
$ xzcat ~/LLVM/gz/llvm-6.0.0.src.tar.xz | tar x
# clang
$ cd ~/LLVM/llvm-6.0.0.src/tools
$ xzcat ~/LLVM/gz/cfe-6.0.0.src.tar.xz | tar x
$ mv cfe-6.0.0.src clang
# compiler-rt
$ cd ~/LLVM/llvm-6.0.0.src/projects
$ xzcat ~/LLVM/gz/compiler-rt-6.0.0.src.tar.xz | tar x
$ mv compiler-rt-6.0.0.src compiler-rt

optional

  • lld (linker)
  • lldb (debugger, better C++ support)
  • libcxx/libcxxabi (C++11 Standard Library Support)
  • linunwind (for platforms that do not have a system HP unwinder)
  • openmp (parallel)
  • polly (polyhedral optimizations)
  • clang-tools
    • clang-tidy (C++ linter static analyzer, CERT only, no MISRA)
    • clangd (IDE helper: source browser,..)
    • clang-doc (automated docs generator, early state, use DoxyGen)

configure

$ rm -rf ~/LLVM/build ; mkdir ~/LLVM/build ; cd ~/LLVM/build
$ cmake ~/LLVM/llvm-6.0.0.src \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=$HOME/tmp/LLVM \
$ make && make install

Gives build error:

	-DLLVM_ENABLE_PIC=ON \
	-DLLVM_ENABLE_LTO=Full \

ARM options (not works yet)

	-DCMAKE_CROSSCOMPILING=True \
	-DLLVM_DEFAULT_TARGET_TRIPLE=arm-none-eabi \
	-DLLVM_TARGET_ARCH=host \
	-DLLVM_TARGETS_TO_BUILD="ARM;X86" \
	-DCMAKE_SYSROOT=$HOME/tmp/LLVM/sysroot \