This is what I did to compile the latest Clang on Kubunut (AKA Kuboobtu).
First things first. You’ll need to download llvm. You may need to set permissions on /usr/local/src
sud apt-get install gcc g++ subversion cd /usr/local/src svn co https://llvm.org/svn/llvm-project/llvm/trunk llvm
Then you will need clang.
cd llvm/tools svn co https://llvm.org/svn/llvm-project/cfe/trunk clang
Next, you will need to patch up clang/lib/Frontend/InitHeaderSearch.cpp
cd clang/lib/Frontend vim InitHeaderSearch.cpp /hard
// FIXME: temporary hack: hard-coded paths. Twine _x("/usr/include/c++/4.6"); Twine _x1("/usr/include/c++/4.6/x86_64-linux-gnu/."); Twine _x2("/usr/include/c++/4.6/backward"); Twine _x3("/usr/lib/gcc/x86_64-linux-gnu/4.6.1/include"); Twine _x4("/usr/local/include"); Twine _x5("/usr/lib/gcc/x86_64-linux-gnu/4.6.3/include-fixed"); Twine _x6("/usr/include/x86_64-linux-gnu"); Twine _x7("/usr/include"); AddPath(_x, System,false); AddPath(_x1, System, false); AddPath(_x2, System, false); AddPath(_x3, System, false); AddPath(_x4, System, false); AddPath(_x5, System,false); AddPath(_x6, System, false); AddPath(_x7, System, false);
I can’t remember why I did it this way…You should be able to write strings directly as the first argument of AddPath, but I didn’t, it was like 1 a.m. and you go with what you know.
cd /usr/local/src/llvm mkdir buid cd build ../configure --enable-targets=host-only --enable-optimized make -j 5 sudo make install
Hopefully that will take care of getting clang on your system. At this point, I created a tar of the whole shebang as it was a successful build and I wanted to keep it around just in case I fucked things up after this point.
cd /usr/local/src svn co https://llvm.org/svn/llvm-project/libcxx/trunk libcxx cd libcxx/lib ./buildit
cd /usr/lib sudo ln -sf /usr/local/src/libcxx/lib/libc++.so.1.0 libc++.so sudo ln -sf /usr/local/libcxx/lib/libc++.so.1.0 libc++.so.1 cd /usr/include/c++ sudo ln -sf /usr/local/src/libcxx/include v1
Many thanks to solarianprogrammer as most of the details actually came from his post on the same topic. There were 1 or 2 small differences in what I did to get success. I post it here because sites and blogs come and go.