LLVM/Clang Admin

Installation Procedure

  1. You might need to put /usr/bin at the head of your PATH so you build this with lethe's system gcc rather than the newer /util/bin/gcc.
  2. Follow llvm.org's Clang/LLVM installation procedure through step 5. Download and configure the source in /src/util/llvm.
  3. Compile fail! Hack the sanitizer platform limits file as described here.
  4. In step 6:
    1. Name the build directory llvm-build instead of build to keep it distinct from other codebases in /src/util.
    2. Our /util version of Python 3.0 didn't work, and lethe's system Python 2.4.x was below LLVM/Clang's minimum requirement of Python 2.5. Modify the configure line to be:
      
      % ../llvm/configure --prefix=/util/llvm --with-python=/util/python-2.7/bin/python --with-gcc-toolchain=/util/gcc
      % setenv LD_LIBRARY_PATH /util/gcc/lib64:${LD_LIBRARY_PATH}
      % /util/bin/cmake /src/util/llvm/
      % sudo env LD_LIBRARY_PATH=/util/gcc/lib64/:${LD_LIBRARY_PATH} make install
      
      
  5. Proceed with defined instructions.

Updated Installation Procedure

Install LLVM

  1. You're generally following the CMake build procedure.
  2. Download recent versions of LLVM and a href="http://releases.llvm.org/" target="_blank">Clang source code.
  3. You might need to upgrade cmake to a more recent version. See separate instructions.
  4. Move source to artemis:/src/util/.
  5. Unzip, untar:
    
    [artemis] util% tar xvfJ llvm-5.0.1.src.tar.xz
    [artemis] util% tar xvfJ cfe-5.0.1.src.tar.xz
    
    
  6. Move the unzipped, untarred cfe-5.0.1.src source directory into the LLVM source directory's tools subdirectory.
  7. Rename the cfe-5.0.1.src source directory to clang.
  8. Create a build directory:
    
    [artemis] util% mkdir llvm-5.0.1-build
    
    
  9. cd llvm-5.0.1-build
  10. 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}
    
    
  11. Generate the files required for building LLVM:
    
    [artemis] llvm-5.0.1-build% /util/bin/cmake ../llvm-5.0.1.src
    
    
  12. Build:
    
    [artemis] llvm-5.0.1-build% /util/bin/cmake --build .
    
    
  13. 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
    
    

Install Clang

  1. Download a recent version of Clang source code.
  2. Move source to artemis:/src/util/.
  3. Unzip, untar:
    
    [artemis] util% tar xvfJ cfe-5.0.1.src.tar.xz
    
    

References

  1. http://clang.llvm.org/get_started.html
  2. http://clang-developers.42468.n3.nabble.com/CentOS-5-9-build-bust-rt-san...