[SciPy-dev] compiling against custom atlas/lapack on os x

James Kyle krunk7@gmail....
Wed Sep 23 09:02:11 CDT 2009


I posted this to scipy-users about a week ago, but after thinking  
about it the dev list seemed more appropriate.

My apologies for this cross post.

----------------------------

Morning,

I'm attempting to build scipy against a custom atlas/lapack library on  
Snow Leopard (this is for inclusion in macports).

I've set my build environment according to the documentation here:

> http://www.scipy.org/Installing_SciPy/BuildingGeneral

Here's my environment and build command:

CPATH='/Users/jkyle/Projects/macports/mports/include' LAPACK='/Users/ 
jkyle/Projects/macports/mports/lib' LIBRARY_PATH='/Users/jkyle/ 
Projects/macports/mports/lib' MACOSX_DEPLOYMENT_TARGET='10.6' ATLAS='/ 
Users/jkyle/Projects/macports/mports/lib' CC='/Users/jkyle/Projects/ 
macports/mports/bin/gcc-mp-4.3' BLAS='/Users/jkyle/Projects/macports/ 
mports/lib' CXX='/Users/jkyle/Projects/macports/mports/bin/g++-mp-4.3'  
CCFLAGS='-I/Users/jkyle/Projects/macports/mports/include -L/Users/ 
jkyle/Projects/macports/mports/lib'

python2.6 setup.py --no-user-cfg config_fc --fcompiler gnu95 -- 
f77exec /Users/jkyle/Projects/macports/mports/bin/gfortran-mp-4.3 -- 
f90exec /Users/jkyle/Projects/macports/mports/bin/gfortran-mp-4.3 build

And here is the configuration output:

http://pastie.org/622884


Now, everything seems to go ok, but when I check the resulting  
libraries I noticed that they are still linking against the system  
vecLib and Accelerate frameworks (the system os x lapack/blas) when  
building the cblas.so and fblas.so libraries.

The build also seems to create two sets of the cblas and fblas  
libraries. For example, it installs these linked against my libs:

> /Users/jkyle/Projects/macports/mports/Library/Frameworks/ 
> Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/ 
> linalg/cblas.so:
> 	/Users/jkyle/Projects/macports/mports/lib/liblapack.dylib  
> (compatibility version 0.0.0, current version 0.0.0)
> 	/Users/jkyle/Projects/macports/mports/lib/libptf77blas.dylib  
> (compatibility version 0.0.0, current version 0.0.0)
> 	/Users/jkyle/Projects/macports/mports/lib/libptcblas.dylib  
> (compatibility version 0.0.0, current version 0.0.0)
> 	/Users/jkyle/Projects/macports/mports/lib/libatlas.dylib  
> (compatibility version 0.0.0, current version 0.0.0)
> 	/Users/jkyle/Projects/macports/mports/lib/gcc43/libgfortran.3.dylib  
> (compatibility version 4.0.0, current version 4.0.0)
> 	/Users/jkyle/Projects/macports/mports/lib/gcc43/libgcc_s.1.dylib  
> (compatibility version 1.0.0, current version 1.0.0)
> 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current  
> version 124.1.1)
>
> /Users/jkyle/Projects/macports/mports/Library/Frameworks/ 
> Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/ 
> linalg/fblas.so:
> 	/Users/jkyle/Projects/macports/mports/lib/liblapack.dylib  
> (compatibility version 0.0.0, current version 0.0.0)
> 	/Users/jkyle/Projects/macports/mports/lib/libptf77blas.dylib  
> (compatibility version 0.0.0, current version 0.0.0)
> 	/Users/jkyle/Projects/macports/mports/lib/libptcblas.dylib  
> (compatibility version 0.0.0, current version 0.0.0)
> 	/Users/jkyle/Projects/macports/mports/lib/libatlas.dylib  
> (compatibility version 0.0.0, current version 0.0.0)
> 	/Users/jkyle/Projects/macports/mports/lib/gcc43/libgfortran.3.dylib  
> (compatibility version 4.0.0, current version 4.0.0)
> 	/Users/jkyle/Projects/macports/mports/lib/gcc43/libgcc_s.1.dylib  
> (compatibility version 1.0.0, current version 1.0.0)
> 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current  
> version 124.1.1)

And it installs these linked against the system libs:
>
> /Users/jkyle/Projects/macports/mports/Library/Frameworks/ 
> Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/lib/ 
> blas/cblas.so:
> 	/System/Library/Frameworks/Accelerate.framework/Versions/A/ 
> Accelerate (compatibility version 1.0.0, current version 4.0.0)
> 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current  
> version 124.1.1)
> /Users/jkyle/Projects/macports/mports/Library/Frameworks/ 
> Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/lib/ 
> blas/fblas.so:
> 	/Users/jkyle/Projects/macports/mports/lib/gcc43/libgfortran.3.dylib  
> (compatibility version 4.0.0, current version 4.0.0)
> 	/System/Library/Frameworks/Accelerate.framework/Versions/A/ 
> Accelerate (compatibility version 1.0.0, current version 4.0.0)
> 	/Users/jkyle/Projects/macports/mports/lib/gcc43/libgcc_s.1.dylib  
> (compatibility version 1.0.0, current version 1.0.0)
> 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current  
> version 124.1.1)


Lastly, I'm noticing that scipy is building with mixed compilers. I've  
set both CC and CXX in my build environment to 4.3. However, in the  
build logs I see that scipy is using gcc-4.2 for some things. For  
example:

> creating build/temp.macosx-10.6-i386-2.6/scipy/cluster
> creating build/temp.macosx-10.6-i386-2.6/scipy/cluster/src
> compile options: '-I/Users/jkyle/Projects/macports/mports/Library/ 
> Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ 
> numpy/core/include -I/Users/jkyle/Projects/macports/mports/Library/ 
> Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ 
> numpy/core/include -I/Users/jkyle/Projects/macports/mports/Library/ 
> Frameworks/Python.framework/Versions/2.6/include/python2.6 -c'
> gcc-mp-4.3: scipy/cluster/src/vq_module.c
> gcc-mp-4.3: scipy/cluster/src/vq.c
> /Users/jkyle/Projects/macports/mports/Library/Frameworks/ 
> Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy/core/ 
> include/numpy/__multiarray_api.h:969: warning: '_import_array'  
> defined but not used
> /usr/bin/gcc-4.2 -L/Users/jkyle/Projects/macports/mports/lib -bundle  
> -undefined dynamic_lookup build/temp.macosx-10.6-i386-2.6/scipy/ 
> cluster/src/vq_module.o build/temp.macosx-10.6-i386-2.6/scipy/ 
> cluster/src/vq.o -Lbuild/temp.macosx-10.6-i386-2.6 -o build/ 
> lib.macosx-10.6-i386-2.6/scipy/cluster/_vq.so
> building 'scipy.cluster._hierarchy_wrap' extension
> compiling C sources
> C compiler: /Users/jkyle/Projects/macports/mports/bin/gcc-mp-4.3 - 
> fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 - 
> Wall -Wstrict-prototypes

Here, the C compiler is gcc-mp-4.3, but the one actually used is  
gcc-4.2.


Any tips are very welcome.

Cheers,

-james


More information about the Scipy-dev mailing list