[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Using Subversion Python/SWIG bindings on OS X

From: Nicholas Riley <njriley_at_uiuc.edu>
Date: 2002-12-12 19:28:14 CET

It is not possible to load multiple SWIG 1.3.17-generated Python
modules under Python 2.2.x on OS X. The problem exhibits itself as
the following unhelpful error message:

>>> import svn._ra
>>> import svn._fs
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: Failure linking new module

Python 2.2.x on OS X, including the version of Python 2.2 shipped by
Apple, loads all extension modules into the same namespace. Both
_ra.so and _fs.so define some of the same symbols, which triggers a
failure in NSLinkModule for the second module.

A solution that worked for me (thanks very much to Jack Jansen over on
the pythonmac-sig mailing list for his help) was to compile my own
version of Python 2.2.2, replacing Python/dynload_next.c with the
version from CVS:


This version includes an option, USE_DYLD_GLOBAL_NAMESPACE, which when
undefined (the default) causes modules to be loaded into private
namespaces. If USE_DYLD_GLOBAL_NAMESPACE is defined, the 2.2.x
behavior recurs, but you get this much more helpful message:

>>> import svn._fs
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: Failure linking new module: : dyld: ./python.exe multiple
definitions of symbol _SWIG_ConvertPacked
definition of _SWIG_ConvertPacked
definition of _SWIG_ConvertPacked

It's possible to share the SWIG runtime functions between modules, to
avoid this problem:


There is one more problem, which I'll cover in a separate email (it
requires a small patch to subversion).

Some variant of this message should probably go in the documentation
somewhere, at least until Python 2.3 is released with the
above-mentioned fixes.

=Nicholas Riley <njriley_at_uiuc.edu> | <http://www.uiuc.edu/ph/www/njriley>
        Pablo Research Group, Department of Computer Science and
  Medical Scholars Program, University of Illinois at Urbana-Champaign
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Dec 12 19:28:57 2002

This is an archived mail posted to the Subversion Dev mailing list.