[Pythonmac-SIG] vecLib Framework on the Mac and distutils

Bill Spotz wfspotz at sandia.gov
Wed Dec 17 13:16:23 EST 2003


I am hoping someone will be able to shed some light on this strange 
problem I'm having.

I am trying to develop a C++ extension to python that must link with 
LAPACK.  I am doing my development on the Mac, so I want to link with 
-framework veclib.

OS: Mac OS X 10.2.8
python: 2.3 (via fink)
gcc: 3.1

I am using distutils to build the extension, and assign ["-framework 
veclib -lSystem"] to the extra_link_args argument of the setup() 
command in setup.py.  However, the resulting extension library built by 
distutils does not recognize the LAPACK routines.

What is weird is that if I take the exact same link command generated 
by distutils and execute it on the command line, I get an extension 
library that DOES recognize the LAPACK routines and in fact passes its 
regression tests.

On the mac, if you set the following environment variables: 
RC_TRACE_ARCHIVES and RC_TRACE_DYLIBS, you'll get a trace from ld 
specifying which static and dynamic libraries are loaded.  Sure enough, 
when executed from distutils, the link step doesn't load in the vecLib 
framework, but it does when issued from the command line.  All the 
other libraries are loaded the same, although the order is somewhat 
different between the two cases.

For what it is worth, this is the generated link command:

c++ -L/sw/lib -bundle -flat_namespace -undefined suppress 
build/temp.darwin-6.8-PowerMacintosh-2.3/Epetra_wrap.o -LCommon 
-L/usr/local/lib -L/usr/local/lib -L/sw/lib/python2.3/config -lcommon 
-lepetra -lswigpy -lpython2.3 -o 
build/lib.darwin-6.8-PowerMacintosh-2.3/_Epetra.so -framework veclib 
-lSystem

Any help will be appreciated.

** Bill Spotz                                              **
** Sandia National Laboratories  Voice: (505)845-0170      **
** P.O. Box 5800                 Fax:   (505)284-5451      **
** Albuquerque, NM 87185-0316    Email: wfspotz at sandia.gov **





More information about the Pythonmac-SIG mailing list