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

Jeff Whitaker jsw@cdc.noaa.gov
Mon, 4 Mar 2002 05:43:19 -0700 (MST)


Marcel:  Thanks for the tip. Unfortunately, when I remove the
"-flat_namespace" and "-undefined suppress" flags I get lots of undefined
symbols like this:

cc -L/sw/lib -bundle build/temp.darwin-5.3-PowerMacintosh-2.3/_kindsmodule.o -o
build/lib.darwin-5.3-PowerMacintosh-2.3/kinds/_kinds.so
/usr/bin/ld: Undefined symbols:
_PyDict_SetItemString
_PyErr_Occurred
_PyModule_GetDict
_Py_BuildValue
_Py_FatalError
_Py_InitModule4
error: command 'cc' failed with exit status 1

I wonder how you avoided this?

-Jeff

 On Sun, 3 Mar 2002, Marcel Prastawa wrote:

> 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
>
>

-- 
Jeffrey S. Whitaker         Phone  : (303)497-6313
Meteorologist               FAX    : (303)497-6449
NOAA/OAR/CDC  R/CDC1        Email  : jsw@cdc.noaa.gov
325 Broadway                Web    : www.cdc.noaa.gov/~jsw
Boulder, CO, USA 80303-3328 Office : Skaggs Research Cntr 1D-124