[Pythonmac-SIG] building extensions that link against dynamic libraries (revisited)

Jack Jansen Jack.Jansen at cwi.nl
Mon Apr 26 06:58:09 EDT 2004


On 26-apr-04, at 6:47, Robert Tolbert wrote:

> I hate to dredge up an old topic, but I've spent more time chasing 
> this weird problem and am still befuddled as to why I can't get this 
> to work.
>
> The original question was posted here:
>
> http://mail.python.org/pipermail/pythonmac-sig/2004-January/009911.html
>
> where I asked some questions about importing an extension that is 
> linked against a shared dynamic library that I've also built. In a 
> nutshell, I am wrapping a large C++ API in Python using SWIG. I can 
> built the base C++ libraries as either static libs or dynamic libs. I 
> can built the extension linked against either of these. And here is 
> where the difference lies.
>
> If I link against the static libraries, my extension loads and works 
> just fine.
>
> If I link against the dynamic libraries, Python hangs trying to import 
> the extension. Ctrl-C won't interupt it, I have to Ctrl-Z and kill -9 
> to get it to stop.

First I want to reiterate the last suggestion I made back in January: 
use some of the DYLD debugging environment variables to see if you can 
figure out what is going on. Especially now that you have it working 
with fink-python that could turn out to be very helpful (see where 
fink-python mac apple-python differ). DYLD_PRINT_LIBRARIES comes to 
mind, and you may also want to play with DYLD_BIND_AT_LAUNCH and 
DYLD_ABORT_MULTIPLE_INITS

Another suggestion is to (temporarily) make sure you don't need 
DYLD_LIBRARY_PATH by putting your shared libraries in /usr/local/lib. 
This'll let you work out whether the problem is somehow related to how 
you set DYLD_LIBRARY_PATH or how it is picked up or something.
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma 
Goldman




More information about the Pythonmac-SIG mailing list