[lxml-dev] install lxml 2.0.5 on Mac OS X Leopard - why is it so hard?
Stefan Behnel
stefan_ml at behnel.de
Sun May 11 09:01:01 CEST 2008
Hi Kumar,
you ask why this is so hard? Simple answer: because no-one has contributed a
way so far to make it easier.
We had lots of reports about stuff not working and almost as many
work-arounds, but no-one came up with a patch that would allow building lxml
reliably at least on a subset of Mac-OS systems. And I just cannot believe
that there is no-one amongst the Mac-OS-X users who knows how to use distutils
to build a binary extension. Or at least someone who knows how to build C code
statically against a C library.
>From my POV, Mac-OS seems to lack three things that make this problem
non-trivial. It doesn't have a standard package management system. Neither
does it have something like the Linux Standard Base, which dictates where
newly installed things belong. And it doesn't seem to support "rpath", which
would allow a binary to say "I know where my dependencies come from". Or at
least distutils don't support that on Mac. So everything I could try here on
Linux to make it work better is bound to fail.
Kumar McMillan wrote:
> I know this has been discussed over and over but I'm writing to see if
> anyone has made a breakthrough yet. The problem of course is that
> Leopard's builtin libxml2 and libxslt are too old for lxml 2.0. You
> have to build libxml2 either from source or use a port.
[lots of important details skipped to keep this at a higer level for now]
> Next, I tried doing a static build of lxml by setting
> STATIC_LIBRARY_DIRS = ['/opt/local/lib'] in setup.py and running:
>
> python setup.py bdist_egg --static
> --with-xml2-config=/opt/local/bin/xml2-config
> --with-xslt-config=/opt/local/bin/xslt-config
>
> I had to fiddle with gcc to get this to build but otherwise it built
> fine and installed ok but I did not see any difference. Still
> consistent segfaults that are fixed by setting the dyld path.
This is because the --static switch was made specifically for static building
on Windows, which has even less support for package management or even
half-decent software installation. It just doesn't support Mac-OS as no-one
ever told me how to support it.
If you want this to run, let's make a deal. Here is a patch (against the
trunk, but should work with 2.0.x) that lets --static require setting the
STATIC_*_DIRS variables only on Windows, which should result in reading the
directories from xml2-config/xslt-config if the hard-coded setup is not
provided. Given your above example, this should be the right thing to do. Now,
please look at the function "libraries()" in setupinfo.py and fix it up for
Mac-OS-X (and for whatever sys.platform calls it) to find the correct static
libraries in these directories. If you get it to run reliably on your system,
just with your above command line, I'll make sure it gets into 2.0.6.
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: setupinfo.py-static-non-windows.patch
Type: text/x-patch
Size: 1871 bytes
Desc: not available
Url : http://codespeak.net/pipermail/lxml-dev/attachments/20080511/dd5990b2/attachment.bin
More information about the lxml-dev
mailing list