[Pythonmac-SIG] Re: Pythonmac-SIG] SciPy

Marcel Prastawa prastawa@cs.unc.edu
Sun, 03 Mar 2002 10:07:23 -0500


Jeff Whitaker wrote:
> Hi:  I'm a fink developer and the maintainer of the python package (and
> most of the scientific stuff).  I've succeeded in patching scipy so that
> it will compile, but as of now I can't get it to run.  The problem is that
> with apple's dynamic linker, you can't have two loadable modules (A,B)
> both linking the same static library (C).  They compile fine, but when you
> try to load A and B in python, you get multiply defined symbol errors (for
> all the symbols in C both A and B reference), and the import fails. The
> only solution I know of is to recompile all of the statics libs (which in
> scipy case is quite a few, including libg2c and atlas) as shared libs.
> If anyone knows another way around this problem, I'd love to hear about
> it.

Jeff,

I have experienced the same problem with Numeric and my own extension 
(both linked to LAPACK and ATLAS). One solution would be to compile both 
modules as two-level namespace extensions.

This will probably be the default behavior for distutils in 2.2.1. For 
now, you could do this manually by editing 
/sw/lib/python2.2/config/Makefile.
Set LDSHARED (or BLDSHARED, I can't remember which, you could change 
both) to
"$(CC) $(LDFLAGS) -bundle -bundle_loader /sw/bin/python"
Basically, you need to remove the "-flat_namespace" and the "-undefined 
suppress" flags.

That should do the trick. BTW, I just realized that you probably don't 
need to compile both as two-level namespace extensions, just one of them.

Marcel