2011-01-26

Building Python with LLVM 2.8 (and why I still love the project)

With Python 3.2 due out in less than three weeks and LLVM 2.8 being the latest release of LLVM, I figure I will not be the only person in the world building Python with LLVM in the near future (let alone building other releases like Python 3.1.3 or Python 2.7.1 with LLVM 2.8). So, to simplify the lives of those that do, I just wanted to point out issue 10238 which notes that to build ctypes you should use the -no-integrated-as compiler flag (I have it set in my CFLAGS environment variable). Do note that LLVM 2.9 has a fix already and this issue only affects the ctypes module. I will see if I can't find some autoconf expert to write up a patch for Python 3.2 to auto-detect LLVM 2.8 and add the flag (if you are such an expert please submit a patch!).

But honestly I don't feel that put out by this issue. When I reported the bug to LLVM they responded within an hour that it had been fixed for LLVM 2.9 and what the fix was. This just continues my wonderful experience interacting with the LLVM project.

But beyond that I appreciate all the tools they provide. For instance, I just ran the Clang static analyzer over Python 3.2rc1 (see issue 8914). The HTML output is really slick! And it honestly was not difficult to do thanks to the command-line tool they provide to work with configure/make files. And even during normal compilation, the warnings that are outputted by clang are so much nicer than those from gcc that I honestly could not imagine going back to it for C/C++ compilation. I (continue) to highly recommend LLVM and clang for any C-related development.