Recompiling lxml on Windows with Python 2.5

In order to improve lxml for C14N, I had to recompile my patched version. I followed the build instructions on the lxml website but I came across a few issues. Here are a few tips to save some time.

MS Visual Studio 2003 or Mingw32
First, a C compiler is required to build lxml. There are some tutorials explaining how to use Mingw32, but as I had Visual Studio 2008 installed I preferred to use it. The issue is that only Visual Studio 2003 is supported to compile any C module with Python 2.5. I spent a lot of time on Google without finding any hack to use VS2005 or VS2008. Sadly, there is no free/demo version of VS2003 available on the Internet anymore. So either you can find VS2003, or Mingw32 is your friend.

TortoiseSVN 1.5
You also need a Subversion client to get lxml source code. I use TortoiseSVN (, which has been upgraded to version 1.5 recently. It appears that there might be some incompatibility between SVN 1.5 and Python setuptools. The symptom is a cryptic error message when building lxml: "NameError: global name 'log' is not defined"...
The simplest solution I found is to remove ALL ".svn" directories from the lxml source tree. After this quick fix, building lxml works just fine.