sreda, 4. november 2009

Building lxml on Mac OS X 10.6 (Snow Leopard)

Build of lxml on Mac OS X 10.6 (Snow Leopard) is broken at the moment (2009-11-03). Here are the steps that worked for me in order to build it.

1. Fix the Makefile in /Library/Frameworks/Python.framework/Versions/Current/lib/python2.5/config by:
- replacing all occurences of "MacOSX10.4u.sdk" with "MacOSX10.5.sdk" and
- setting "MACOSX_DEPLOYMENT_TARGET' to "10.5"

2. Install Cython

3. Check out the source: svn co http://codespeak.net/svn/lxml/tag/lxml-2.2.3
(remark: the latest trunk did not work for me)

4. In directory lxml-2.2.3 fix the file buildlibxml.py by:
- replacing all occurences of "MacOSX10.4u.sdk" with "MacOSX10.5.sdk" and
- setting "MACOSX_DEPLOYMENT_TARGET' to "10.5"

5. Build and install lxml by issuing:
- python setup.py install --static-deps


I hope it works for you too!

Dušan