- You're generally following the CMake build procedure.
- Download recent versions of LLVM and a href="http://releases.llvm.org/" target="_blank">Clang source code.
- You might need to upgrade cmake to a more recent version. See separate instructions.
- Move source to
artemis:/src/util/
.
- Unzip, untar:
[artemis] util% tar xvfJ llvm-5.0.1.src.tar.xz
[artemis] util% tar xvfJ cfe-5.0.1.src.tar.xz
- Move the unzipped, untarred
cfe-5.0.1.src
source directory into the LLVM source directory's tools
subdirectory.
- Rename the
cfe-5.0.1.src
source directory to clang
.
- Create a build directory:
[artemis] util% mkdir llvm-5.0.1-build
cd llvm-5.0.1-build
- Set necessary environment variables:
[artemis] llvm-5.0.1-build% setenv CC /util/bin/gcc
[artemis] llvm-5.0.1-build% setenv CXX /util/bin/g++
[artemis] llvm-5.0.1-build% setenv LD_LIBRARY_PATH /util/gcc/lib64:/util/lib:${LD_LIBRARY_PATH}
- Generate the files required for building LLVM:
[artemis] llvm-5.0.1-build% /util/bin/cmake ../llvm-5.0.1.src
- Build:
[artemis] llvm-5.0.1-build% /util/bin/cmake --build .
- Install to a location with a custom prefix:
[artemis] llvm-5.0.1-build% sudo env LD_LIBRARY_PATH=/util/gcc/lib64/:${LD_LIBRARY_PATH} /util/bin/cmake -DCMAKE_INSTALL_PREFIX=/util/llvm-5.0.1 -P cmake_install.cmake