[lxml-dev] install lxml 2.0.5 on Mac OS X Leopard - why is it so hard?
Kumar McMillan
kumar.mcmillan at gmail.com
Thu May 15 06:40:58 CEST 2008
Hello again
On Wed, May 14, 2008 at 1:01 AM, Stefan Behnel <stefan_ml at behnel.de> wrote:
>> Next up, I'm pretty sure I need to pass -static to libtool so that it
>> honors the -lxml2.a (without -static, it says xml2.a -- lib not
>> found).
>
> It's not "-lxml2.a" but a plain "/path/to/libxml2.a" as parameter to link it
> in just like the normal lxml.etree.o object file that was just compiled.
when I tried the plain paths it says library cannot be found. But
I've discovered that building with -static is a dead end. It seems
that Apple all but disallows static linking completely:
http://developer.apple.com/qa/qa2001/qa1118.html
HOWEVER
after blood, sweat, and some tears (kidding) this is *all* I needed, it seems:
export CFLAGS="-flat_namespace"
...no static builds libxml2 libs, no buildout recipe. I just set that and ran:
python setup.py bdist_egg
--with-xml2-config=/opt/local/bin/xml2-config
--with-xslt-config=/opt/local/bin/xslt-config
which uses the libxml2 and etc. installed by ports. In fact, as long
as /opt/local/bin is on my path that should work without having to set
paths (i.e. from easy_install). All my tests that were segfaulting
are now passing. This appears to be the exact same behavior I got by
setting DYLD_FORCE_FLAT_NAMESPACE at runtime but without the side
affect of applying itself to anything else running in my shell ;)
so, I'm thinking this is just two lines of code added to cflags() ...
if sys.platform in ('darwin',):
result.append('-flat_namespace')
Do you want a patch that also includes the adjustments to --static
when not windows? I don't think they are necessary anymore.
Actually, using --static on darwin should probably raise an error
"Apple says no" ;)
-Kumar
More information about the lxml-dev
mailing list