Successfully compiling LLVM with MacPorts

I had a huge issue for quite some time trying to get LLVM 3.0 and 3.1 to compile with MacPorts. This prevented MacPorts updating outdated ports as the process would stall with CLANG’s RAM use spilling over and filling up the swap disk. With a bit of trial and error, I got some joy after reading these posts:

What worked for me was to change the python version to 2.7 and using a different compiler (setting it to GCC worked!). I issued the following commands:

sudo port select python python27
sudo port clean llvm-3.0
sudo port install llvm-3.0 configure.compiler=gcc
sudo port clean llvm-3.1
sudo port install llvm-3.1 configure.compiler=gcc