[lxml-dev] install lxml 2.0.5 on Mac OS X Leopard - why is it so hard?

Stefan Behnel stefan_ml at behnel.de
Mon May 12 11:04:44 CEST 2008


Hi,

Kumar McMillan wrote:
> I don't have experience building native OS X applications

See? That seems to be a general problem amongst Mac-OS users. If no-one using
that platform knows how to build a C program, how am I supposed to know it?


> What is two-level namespacing?

*shrug*, I prefer an automatic static build on Mac-OS anyway.


> You say your patch removed the enforcement of STATIC_*_DIRS but that was
> never a problem.

It was, as it requires manual interaction by users that should only be
required in stupid "who-needs-a-system-compiler-anyway" environments like Windows.


> in fact, that seems to confuse gcc when building
> with --static since it produces orphaned -I args (no directory
> attached)

It just disables the requirement for setting the variables. It doesn't
configure anything so far. The config has to come from xml2-config and
xslt-config.


> Next, you suggest to adjust the sys.platform checks.  sys.platform
> always equals "darwin" on OS X

Ok, then the function will likely look something like this:


  def libraries():
    if sys.platform in ('win32', 'darwin'):
        libs = ['libxslt', 'libexslt', 'libxml2', 'iconv']
    else:
        libs = ['xslt', 'exslt', 'xml2', 'z', 'm']
    if OPTION_STATIC:
        if sys.platform in ('win32',):
            libs = ['%s_a' % lib for lib in libs]
        elif sys.platform in ('darwin',):
            libs = ['%s.a' % lib for lib in libs]
    if sys.platform in ('win32',):
        libs.extend(['zlib', 'WS2_32'])
    return libs

Minus some changes for libiconv and libz.


> but where would I want to make
> adjustments?  I don't understand what this is doing in libraries() :
> 
> if sys.platform in ('win32',):
>     libs = ['%s_a' % lib for lib in libs]
> 
> if I add "darwin" to the list, I get the error:
> ld: library not found for -lxslt_a

The static libraries are called xxx_a in Windows. If someone can figure out
what they are called on Mac-OS, I can fill it in myself.


> whereas -lxslt is the correct arg (just like on linux).  In my
> /opt/local/lib dir I have libxslt.dylib, libxslt.la, libexslt.dylib,
> libexslt.la, etc.  I tried changing the above list comprehension to
> generate .la names but that didn't work either (still said library not
> found).

Hmmm, on Linux, the static libraries are called "libxml2.a" etc. Can you find
anything like that on your system?

Stefan



More information about the lxml-dev mailing list