[SciPy-dev] scipy 0.4.3 won't build with gcc 4.0.1 (Xcode 2.2) on Macos X

Jeff Whitaker jswhit at fastmail.fm
Thu Nov 17 10:59:25 CST 2005


gcc 4.0.1 doesn't like nested functions on MacOS X.

building 'scipy.interpolate.dfitpack' extension
compiling C sources
gcc options: '-fno-strict-aliasing -Wno-long-double -no-cpp-precomp
-mno-fused-madd -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I/sw/
include'
creating build/temp.darwin-8.3.0-Power_Macintosh-2.4/build/src/Lib/interpolate
compile options: '-Ibuild/src
-I/sw/lib/python2.4/site-packages/scipy/base/include
-I/sw/include/python2.4 -c'
gcc: build/src/Lib/interpolate/dfitpackmodule.c
build/src/Lib/interpolate/dfitpackmodule.c: In function
'f2py_rout_dfitpack_surfit_smth':
build/src/Lib/interpolate/dfitpackmodule.c:2528: error: nested
functions are not supported on MacOSX
build/src/Lib/interpolate/dfitpackmodule.c:2540: error: nested
functions are not supported on MacOSX
build/src/Lib/interpolate/dfitpackmodule.c: In function
'f2py_rout_dfitpack_surfit_lsq':
build/src/Lib/interpolate/dfitpackmodule.c:2976: error: nested
functions are not supported on MacOSX
build/src/Lib/interpolate/dfitpackmodule.c:2988: error: nested
functions are not supported on MacOSX
build/src/Lib/interpolate/dfitpackmodule.c: In function
'f2py_rout_dfitpack_surfit_smth':
build/src/Lib/interpolate/dfitpackmodule.c:2528: error: nested
functions are not supported on MacOSX
build/src/Lib/interpolate/dfitpackmodule.c:2540: error: nested
functions are not supported on MacOSX
build/src/Lib/interpolate/dfitpackmodule.c: In function
'f2py_rout_dfitpack_surfit_lsq':
build/src/Lib/interpolate/dfitpackmodule.c:2976: error: nested
functions are not supported on MacOSX
build/src/Lib/interpolate/dfitpackmodule.c:2988: error: nested
functions are not supported on MacOSX
error: Command "gcc -fno-strict-aliasing -Wno-long-double
-no-cpp-precomp -mno-fused-madd -DNDEBUG -g -O3 -Wall
-Wstrict-prototypes
-I/sw/include -Ibuild/src
-I/sw/lib/python2.4/site-packages/scipy/base/include
-I/sw/include/python2.4 -c build/src/Lib/interpolate/
dfitpackmodule.c -o
build/temp.darwin-8.3.0-Power_Macintosh-2.4/build/src/Lib/interpolate/dfitpackmodule.o"
failed with exit status 1

And the first two "nested function" are as follows:


2528>       int calc_lwrk1(void) {
         int u = nxest-kx-1;
         int v = nyest-ky-1;
         int km = MAX(kx,ky)+1;
         int ne = MAX(nxest,nyest);
         int bx = kx*v+ky+1;
         int by = ky*u+kx+1;
         int b1,b2;
         if (bx<=by) {b1=bx;b2=bx+v-ky;}
         else {b1=by;b2=by+u-kx;}
         return u*v*(2+b1+b2)+2*(u+v+km*(m+ne)+ne-kx-ky)+b2+1;
       }
2540>       int calc_lwrk2(void) {
         int u = nxest-kx-1;
         int v = nyest-ky-1;
         int bx = kx*v+ky+1;
         int by = ky*u+kx+1;
         int b2 = (bx<=by?bx+v-ky:by+u-kx);
         return u*v*(b2+1)+b2;
       }

These are indeed nested within another function.  Unfortunately, unlss
the new gcc has a "sloppy-code" flag or something similar, I can't
think of a workaround.

It works fine with Xcode 2.1, which uses gcc 4.0.0.

A thread concerning this behavior has been posted at

http://lists.apple.com/archives/Xcode-users/2005/Nov/msg00267.html


-Jeff

-- 
Jeffrey S. Whitaker         Phone  : (303)497-6313
Meteorologist               FAX    : (303)497-6449
NOAA/OAR/PSD  R/PSD1        Email  : Jeffrey.S.Whitaker at noaa.gov
325 Broadway                Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web    : http://tinyurl.com/5telg




More information about the Scipy-dev mailing list