Successfully compiling LLVM with MacPorts

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:

https://trac.macports.org/wiki/UsingTheRightCompiler
https://trac.macports.org/ticket/34366
https://trac.macports.org/ticket/32575
https://trac.macports.org/ticket/36071

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

YMMV…