Building clang 3.3 from source

Recently I had the need to build a specific version (3.3) of the clang compiler from source. Following the instructions on the clang website this turned out to be quite easy. I recorded the steps here for future reference (steps adapted from http://clang.llvm.org/get_started.html):

1. Checkout llvm
svn co http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_33/final llvm33_src

2. Checkout clang
cd llvm33_src/tools
svn co http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_33/final clang
cd ../..

3. Checkout extra Clang Tools: (optional)
cd llvm33_src/tools/clang/tools/
svn co http://llvm.org/svn/llvm-project/clang-tools-extra/tags/RELEASE_33/final extra
cd ../../../../

4. Checkout Compiler-RT:
cd llvm33_src/projects/
svn co http://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_33/final compiler-rt
cd ../..

5a. Building (Debug build)
mkdir llvm33_build
cd llvm33_build
CC=gcc CXX=g++ ../llvm33_src/configure
make -j8
cd ..

5b. Building (Optimized build)
mkdir llvm33_build
cd llvm33_build
CC=gcc CXX=g++ ../llvm33_src/configure --enable-optimized
make -j8
cd ..

Leave a Reply

Your email address will not be published. Required fields are marked *