I am a big fan of Clang and the whole LLVM project in general. But I kept running into problems trying to compile the recently released LLVM 3.0 infrastructure on my Ubuntu 11.10 computer. Here is the recipe I finally discovered for success.

From Your Shell…

Note: I use the Git repositories for the project. If you prefer to pull from Subversion then you’ll have to substitute the appropriate commands.

$ git clone http://llvm.org/git/llvm.git
$ cd llvm/tools/
$ git clone http://llvm.org/git/clang.git
$ cd ..   # Get back to the root llvm directory.
$ sudo apt-get build-dep clang
$ sudo apt-get install libc6-dev g++-multilib
$ CC="gcc-4.6" CXX="g++" ./configure --prefix=/usr/local && gmake

# Go do something for an hour or more...

$ sudo gmake install

And that should do it. If you run into any errors post them here in the comments and I’ll try to help you out.