[XML-SIG] How-to compile PyXML 0.7 on Mac OS X 10.1.x

Marc Balmer marc@msys.ch
Wed, 16 Jan 2002 10:10:37 +0100


PyXML will not build out of the box on Mac OS X 10.1.x.  The reason
for this is that Apple changed the default behaviour of the link editor
ld regarding the use of namespaces.  With Mac OS 10.0.x the linker
used -flat_namespace by default which allows the suppression of
undefined references using the command line option -undefined
suppress.

With Mac OS X 10.1, however, Apple changed the linkers default
to use two-level namespaces which does not allow the option
-undefined suppress.  All references must be resolved at link time
and thus PyXML fails to compile the C extensions (for a discussion
of namespaces see 'man ld').

In order to build PyXML on Mac OS X 10.1.x the file setup.py must
be modified to use the ld option '-flat_namespace':

Line 30: LDFLAGS = ['-flat_namespace']

The change the build of sgmlop and boolean (line 166 onwards) to

# Build sgmlop
ext_modules.append(
     Extension(xml('.parsers.sgmlop'),
               extra_link_args=LDFLAGS,
               sources=['extensions/sgmlop.c']
               ))

# Build boolean
ext_modules.append(
     Extension(xml('.utils.boolean'),
               extra_link_args=LDFLAGS,
               sources=['extensions/boolean.c']
               ))

With these changes PyXML can built and installed on Mac OS X 10.1.x

- Marc Balmer

--
Marc Balmer, Micro Systems, Kannenfeldstrasse 32, CH-4056 Basel
Tel +41 61 383 05 10, Fax +41 61 383 05 12, http://www.msys.ch/