[lxml-dev] lxml Mac installation idea

Guntsche Michael mike at it-loops.com
Tue Nov 11 22:48:46 CET 2008


On Nov 11, 2008, at 21:47, Stefan Behnel wrote:

> Hi,
>
> Guntsche Michael wrote:
>> What I ment was. If you build lxml yourself get universal builds of
>> libiconv, libxml2 and libxslt from macports or compile them yourself.
>
> Ok, two obvious questions:
>
> 1) how can setup.py figure out if it's running in a universally  
> built Python?
>
If you use distutils or setuptools the flags are added automatically.  
I quickly looked at distutils and saw that you could check for a
the UNIVERSALSDK config_var

 >>> from distutils import sysconfig
 >>> sysconfig.get_config_var('UNIVERSALSDK')
'/Developer/SDKs/MacOSX10.4u.sdk'

which should be empty on non-Universal Binary builds.


> 2) how do you configure the build of libxml2/libxslt/libiconv to be  
> universal?
> Mark wrote that "-arch i386 -arch ppc" will do the trick. Is that  
> the right
> way of doing it?
you need

-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk

in CFLAGS and LDFLAGS, isysroot is needed if you are building on a PPC  
machine.
Furthermore you need to pass the "--disable-dependency-tracking"  
switch to ./configure, since this does not work with universal builds  
of the library.
This way you can get a static and dynamic library in Universal Binary  
form.

Example:
========

CFLAGS="-arch i386 -arch ppc" LDFLAGS="-arch i386 -arch ppc" ./ 
configure --without-python --disable-dependency-tracking --disable- 
shared

for libxslt and static libs.

hope that helps,
Mike




More information about the lxml-dev mailing list