[lxml-dev] lxml Mac installation idea
Mark Bestley
lxml{ at bestley.co.uk
Tue Nov 11 18:52:45 CET 2008
I made an attempt to do a Mac OSX build and I think I can answer some of
the questions raised in the various threads. I can't come up with a good
general soultion.
The easiest seems to me to use macports for all the C dependencies and
things seem to just work as they do for Michael Guntsche.
"Stefan Behnel" <stefan_ml at behnel.de> writes:
> Chris Withers wrote:
>> Stefan Behnel wrote:
>
> python setup.py build_ext -i --static-deps
>
> to download and build the libs and then statically build lxml with them.
> This will copy the modules into their package at the end, so you should be
> able to run
>
I attempted this on a Intel OSX 10.5 machine - with a new user so should
have a clean environment
I used the Apple installed python
The steps I think I needed were
0) change setuptools to load to local library as per
<http://peak.telecommunity.com/DevCenter/EasyInstall#mac-os-x-user-installation>
otherwise you need admin rights
1) easy_install Cython - I tried without Cython and it failed as no
src/lxml/lxml.etree.c - which is a known step
2) The build failed with
ld warning: in /Users/nomacports/Public/lxml/build/tmp/libxml2/lib/libexslt.a, file is
not of required architecture
Which is because python is a fat binary with PPC and i386 and the
configure of libxml2 only provides a single archotecture.
I could not get a simple fix as per as per
<http://developer.apple.com/releasenotes/OpenSource/PerlExtensionsRelNotes/>
to work.
I edited setuptools.py adding a line after the test for darwin (at line
197)
result.append( '-arch i386 -arch ppc' )
There is probably a better way to do this but I think we need a
completed build first
> python test.py -vv
>
> afterwards to see if it works as expected. Please report any errors you
> get on the way.
>
>
This failed with the iconv issue noted in other threads e.g.
"setupinfo.py that downloads/builds libxml2/libxslt"
I looked at the shared libraries with OSX toools e.g. otool and think
that the issue is that iconv is called from libxml2 and the reference
seems to have been stripped out in the static build of libxml2
So one answer is to have dynamic libxml etc but to tell configure to
install these in the final target directory rather han the build
directory or use something like py2app's macholib to rewrite the path in
the dylib when copied to site-pakages (or use runtime environment
variables like DYLD_LIBRARY_PATH )
Some alternatives might be
i) download iconv as static as well
ii) call iconv from etree to resolve the refererence
iii) to make the etree link include all the objects in the libxml library
As far as I understand Mac OSX dynamic libraries. They have the full
path of the dynamic libraries they link to as well as their name
embedded in the file. See the output of otool -L filename for details
Macports thus works as all the libraries are in a fixed known place
--
Mark
More information about the lxml-dev
mailing list