[Pythonmac-SIG] Problem with module linking

Nicholas Riley njriley@uiuc.edu
Wed, 11 Dec 2002 15:55:46 -0600


On Wed, Dec 11, 2002 at 04:47:19PM +0100, Jack Jansen wrote:
> First check that the python you're using is indeed a framework-python 
> and not a static python (then you would pull in a second copy of the 
> interpreter from Python.framework, and all sorts of nasty things could 
> happen).

I am using the framework Python (through a few symlinks, the
executable I am running is in /Library/Frameworks/Python.framework).
The Apple-provided non-framework Python exhibits the same problem,
however.

> Second try setting the DYLD_PRINT_LIBRARIES environment variable, which 
> will cause the dynamic loader to tell you what it is doing. You might 
> also try to set DYLD_TRACE, but I never used it. See "man dyld" for 
> details.

With DYLD_PRINT_LIBRARIES I see different output in the two cases.
_fs.so has a subset of the library dependencies of _ra.so: 

CASE 1 - import _fs then _ra

>>> import _fs
loading libraries for image: _fs.so
loading library: /Library/Frameworks/Python.framework/Versions/2.2/Python
loading library: /usr/local/encap/subversion/lib/libsvn_fs-1.0.dylib
loading libraries for image: /usr/local/encap/subversion/lib/libsvn_fs-1.0.dylib
loading library: /usr/local/encap/subversion/lib/libsvn_delta-1.0.dylib
loading library: /usr/local/encap/subversion/lib/libsvn_subr-1.0.dylib
loading library: /usr/local/encap/httpd-2.0/lib/libaprutil-0.0.dylib
loading library: /usr/local/lib/libgdbm.2.dylib
loading library: /usr/local/encap/db-4.0.14/lib/libdb-4.0.dylib
loading library: /usr/local/fink/lib/libexpat.0.dylib
loading library: /usr/local/encap/httpd-2.0/lib/libapr-0.0.dylib
loading libraries for image: /usr/local/encap/subversion/lib/libsvn_delta-1.0.dylib
loading libraries for image: /usr/local/encap/subversion/lib/libsvn_subr-1.0.dylib
loading libraries for image: /usr/local/encap/httpd-2.0/lib/libaprutil-0.0.dylib
loading libraries for image: /usr/local/lib/libgdbm.2.dylib
loading libraries for image: /usr/local/encap/db-4.0.14/lib/libdb-4.0.dylib
loading libraries for image: /usr/local/fink/lib/libexpat.0.dylib
loading libraries for image: /usr/local/encap/httpd-2.0/lib/libapr-0.0.dylib
>>> import _ra
loading libraries for image: _ra.so
loading library: /Library/Frameworks/Python.framework/Versions/2.2/Python
loading library: /usr/local/encap/subversion/lib/libsvn_ra-1.0.dylib
loading libraries for image: /usr/local/encap/subversion/lib/libsvn_ra-1.0.dylib
loading library: /usr/local/encap/subversion/lib/libsvn_ra_local-1.0.dylib
loading library: /usr/local/encap/subversion/lib/libsvn_repos-1.0.dylib
loading library: /usr/local/encap/subversion/lib/libsvn_ra_dav-1.0.dylib
loading library: /usr/local/encap/subversion/lib/libsvn_ra_svn-1.0.dylib
loading libraries for image: /usr/local/encap/subversion/lib/libsvn_ra_local-1.0.dylib
loading libraries for image: /usr/local/encap/subversion/lib/libsvn_repos-1.0.dylib
loading libraries for image: /usr/local/encap/subversion/lib/libsvn_ra_dav-1.0.dylib
loading library: /usr/local/encap/neon-0.23.4/lib/libneon.23.dylib
loading library: /usr/local/fink/lib/libz.1.dylib
loading libraries for image: /usr/local/encap/subversion/lib/libsvn_ra_svn-1.0.dylib
loading libraries for image: /usr/local/encap/neon-0.23.4/lib/libneon.23.dylib
loading libraries for image: /usr/local/fink/lib/libz.1.dylib
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: Failure linking new module

CASE 2 - import _ra then _fs

>>> import _ra
loading libraries for image: _ra.so
loading library: /Library/Frameworks/Python.framework/Versions/2.2/Python
loading library: /usr/local/encap/subversion/lib/libsvn_ra-1.0.dylib
loading libraries for image: /usr/local/encap/subversion/lib/libsvn_ra-1.0.dylib
loading library: /usr/local/encap/subversion/lib/libsvn_ra_local-1.0.dylib
loading library: /usr/local/encap/subversion/lib/libsvn_repos-1.0.dylib
loading library: /usr/local/encap/subversion/lib/libsvn_fs-1.0.dylib
loading library: /usr/local/encap/subversion/lib/libsvn_delta-1.0.dylib
loading library: /usr/local/encap/subversion/lib/libsvn_ra_dav-1.0.dylib
loading library: /usr/local/encap/subversion/lib/libsvn_ra_svn-1.0.dylib
loading library: /usr/local/encap/subversion/lib/libsvn_subr-1.0.dylib
loading library: /usr/local/encap/httpd-2.0/lib/libaprutil-0.0.dylib
loading library: /usr/local/lib/libgdbm.2.dylib
loading library: /usr/local/encap/db-4.0.14/lib/libdb-4.0.dylib
loading library: /usr/local/fink/lib/libexpat.0.dylib
loading library: /usr/local/encap/httpd-2.0/lib/libapr-0.0.dylib
loading libraries for image: /usr/local/encap/subversion/lib/libsvn_ra_local-1.0.dylib
loading libraries for image: /usr/local/encap/subversion/lib/libsvn_repos-1.0.dylib
loading libraries for image: /usr/local/encap/subversion/lib/libsvn_fs-1.0.dylib
loading libraries for image: /usr/local/encap/subversion/lib/libsvn_delta-1.0.dylib
loading libraries for image: /usr/local/encap/subversion/lib/libsvn_ra_dav-1.0.dylib
loading library: /usr/local/encap/neon-0.23.4/lib/libneon.23.dylib
loading library: /usr/local/fink/lib/libz.1.dylib
loading libraries for image: /usr/local/encap/subversion/lib/libsvn_ra_svn-1.0.dylib
loading libraries for image: /usr/local/encap/subversion/lib/libsvn_subr-1.0.dylib
loading libraries for image: /usr/local/encap/httpd-2.0/lib/libaprutil-0.0.dylib
loading libraries for image: /usr/local/lib/libgdbm.2.dylib
loading libraries for image: /usr/local/encap/db-4.0.14/lib/libdb-4.0.dylib
loading libraries for image: /usr/local/fink/lib/libexpat.0.dylib
loading libraries for image: /usr/local/encap/httpd-2.0/lib/libapr-0.0.dylib
loading libraries for image: /usr/local/encap/neon-0.23.4/lib/libneon.23.dylib
loading libraries for image: /usr/local/fink/lib/libz.1.dylib
>>> import _fs
loading libraries for image: _fs.so
loading library: /Library/Frameworks/Python.framework/Versions/2.2/Python
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: Failure linking new module
>>>

Is there any way to get a more detailed error message?  The other
thing I tried was loading a non-Subversion native code module (import
_tkinter), even after importing _fs or _ra it worked fine.  I'm stuck.

I tried setting DYLD_TRACE then running ktrace, but it appears kdump
can't decode it sensibly.  I get output of the form:

 11006 python   CALL  kdebug_trace(0x1f01002a,0x90009600,0,0,0,0)
 11006 python   RET   kdebug_trace -1 errno 22 Invalid argument
 11006 python   CALL  kdebug_trace(0x1f010029,0x9068abb4,0,0,0,0)
 11006 python   RET   kdebug_trace -1 errno 22 Invalid argument

Once again, thanks for your help.  Overall Python on OS X is working
amazingly well for me, I've now moved all my research work over to my
TiBook and am being much more productive for it.

-- 
=Nicholas Riley <njriley@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