So I needed to build the latest llvm i.e. version 3.2 from source today. In this post I will describe the steps for Ubuntu 12.04.
First download the llvm source package from this link. I downloaded the x86 version because I am running 32 bit version of Ubuntu(aka i386).
Link:
32 bit
You can download the x86_64 version if you are running 64 bit Ubuntu(aka amd64).
Link:
64 bit
Put the downloaded .tar.gz archive in a convenient location. I put mine on ~/opt.
Then extract the archive via this command.
cd ~/opt
tar xvzf clang+llvm-3.2-x86-linux-ubuntu-12.04.tar.gz
Now you will have a directory named LLVM.
Go to the llvm directory.
cd LLVM
cd llvm
Now here comes the tricky part. The first time I ran this command
./configure --enable-optimized
and was greeted with the following error at the end:
configure: error: Selected compiler could not find or parse C++ standard library headers. Rerun > with CC=c-compiler CXX=c++-compiler ./configure ...
The main purpose of this post is so that others can get rid of this specific error.
Run the following command to get rid of the above error. You should have clang installed on your computer for this to work.
sudo apt-get install clang
./configure --enable-optimized CC=/usr/bin/clang CXX=/usr/bin/clang++
We have run the configuration script. Next step is to run the make command to start the building process. I should warn you that this is going to take a lo..ng time to finish.
make
After make finishes building run this final command to install.
sudo make install
References: