2008-06-21

I can't build Python using LLVM

Yesterday, quite by accident, I discovered that if you installed Apple's iPhone SDK you end up with LLVM 2.3 (from svn) and llvm-gcc (for gcc 4.2.1) installed under ``/Developer/usr/bin``. Being into compilers, I decided to try to compile 2.5, 2.6, and 3.0 (from svn) using ``CC=llvm-gcc ./configure --with-pydebug --disable-toolbox-glue``. It didn't go so well.

For 2.5, there is a compiler flag that llvm-gcc doesn't support, so that compile ended quickly. For 2.6, running setup.py triggers a bus error. For some reason, PyDateTime_TimeDelta in datetimemodule.c ends up with its tp_alloc slot set to 0, which is bad since that is subsequently called directly to create a new delta instance.

3.0 had a bunch of pydebug messages about the padding byte not being set correctly. And then it did with a bus error.

These are obviously not shallow problems. What I want to know is whether these are actual errors in CPython based on bad assumptions we make thanks to gcc and Visual Studio, or is LLVM at fault. And then there is the chance that I screwed up somehow. =)