Mac OS X and gcc 4.2

Good Afternoon, I'm trying to port a set of finite element tools and linear/ nonlinear multilevel solvers to the new numpy and scipy. I'm having trouble even building the trunk of numpy and scipy on Mac OS X using a recent build of gcc (version 4.2.0 20060710) . Is it pointless for me to even try using something besides apple's gcc 3.3? I'm just getting simple unrecognized option errors, but I don't know how to modify the configuration to get rid of them or ignore them. Could anyone give me some pointers here? Thanks, Chris errors with gcc 4.2: ... gcc: _configtest.c gcc: unrecognized option '-no-cpp-precomp' cc1: error: unrecognized command line option "-arch" cc1: error: unrecognized command line option "-arch" cc1: error: unrecognized command line option "-Wno-long-double" gcc: unrecognized option '-no-cpp-precomp' cc1: error: unrecognized command line option "-arch" cc1: error: unrecognized command line option "-arch" cc1: error: unrecognized command line option "-Wno-long-double" failure. removing: _configtest.c _configtest.o ...

On Wed, Aug 16, 2006 at 03:34:49PM -0500, Chris Kees wrote:
Good Afternoon,
I'm trying to port a set of finite element tools and linear/ nonlinear multilevel solvers to the new numpy and scipy. I'm having trouble even building the trunk of numpy and scipy on Mac OS X using a recent build of gcc (version 4.2.0 20060710) . Is it pointless for me to even try using something besides apple's gcc 3.3? I'm just getting simple unrecognized option errors, but I don't know how to modify the configuration to get rid of them or ignore them. Could anyone give me some pointers here?
Thanks, Chris
errors with gcc 4.2:
... gcc: _configtest.c gcc: unrecognized option '-no-cpp-precomp' cc1: error: unrecognized command line option "-arch" cc1: error: unrecognized command line option "-arch" cc1: error: unrecognized command line option "-Wno-long-double" gcc: unrecognized option '-no-cpp-precomp' cc1: error: unrecognized command line option "-arch" cc1: error: unrecognized command line option "-arch" cc1: error: unrecognized command line option "-Wno-long-double" failure. removing: _configtest.c _configtest.o
Annoying, eh? The *easiest* way I've found to use a different compiler that takes a different set of flags is to make a compiler wrapper script, that deletes the flags your compiler won't recognize, and add others you think you need. I've attached the one I use on my Mac. Just set CC to it before building: $ CC=gcc-wrapper python setup.py build Otherwise, you'll find that you're running into the problem that Python adds flags from its Makefile (kept at lib/python2.4/Config/Makefile) that there is no way to override (BASECFLAGS and OPT -- see distutils.sysconfig). Setting CFLAGS only adds flags to the compiler command. Alternatively, look in numpy/distutils/ccompiler.py at the top. Edit _new_init_posix() to override the 'OPT' and 'BASECFLAGS' config_var (the one for 'OPT' is already there), and uncomment the line below that function that sets distutils.sysconfig._init_posix to this new routine. -- |>|\/|< /--------------------------------------------------------------------------\ |David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/ |cookedm@physics.mcmaster.ca

On Wed, Aug 16, 2006 at 08:37:17PM -0400, David M. Cooke wrote:
Annoying, eh? The *easiest* way I've found to use a different compiler that takes a different set of flags is to make a compiler wrapper script, that deletes the flags your compiler won't recognize, and add others you think you need. I've attached the one I use on my Mac.
probably help if I attached it ... -- |>|\/|< /--------------------------------------------------------------------------\ |David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/ |cookedm@physics.mcmaster.ca

David, Thanks. That got me part of the way through along with similar g+ + and gfortran wrappers like what you gave me. That's nuts that those options are hardwired in. Now I'm getting more link errors because it's trying to build shared libraries without any of the options needed to build them from python extension modules: gfortran-wrapper -m32 -mpowerpc -maltivec -framework Accelerate build/ temp.macosx-10.4-fat-2.4/Lib/integrate/_quadpackmodule.o -L/usr/local/ lib/gcc/powerpc-apple-darwin8.7.0/4.2.0 -Lbuild/temp.macosx-10.4- fat-2.4 -lquadpack -llinpack_lite -lmach -lgfortran -o build/ lib.macosx-10.4-fat-2.4/scipy/integrate/_quadpack.so /usr/bin/ld: Undefined symbols: _PyArg_ParseTuple _PyCObject_AsVoidPtr _PyCObject_Type Anyway, all the tests passed on numpy so I may have to put scipy on the back burner for a while. I just need pysparse and my code ported to the new numpy. FYI, apple's latest default compiler (4.0.1) builds numpy without any trouble on both my intel and power pc macs and all the tests pass, contrary to what I was seeing using gcc 3.3. Chris On Aug 16, 2006, at 7:57 PM, David M. Cooke wrote:
On Wed, Aug 16, 2006 at 08:37:17PM -0400, David M. Cooke wrote:
Annoying, eh? The *easiest* way I've found to use a different compiler that takes a different set of flags is to make a compiler wrapper script, that deletes the flags your compiler won't recognize, and add others you think you need. I've attached the one I use on my Mac.
probably help if I attached it ...
-- |>|\/|< /--------------------------------------------------------------------- -----\ |David M. Cooke http:// arbutus.physics.mcmaster.ca/dmc/ |cookedm@physics.mcmaster.ca <gcc-wrapper> _______________________________________________ Scipy-dev mailing list Scipy-dev@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-dev

On Thu, Aug 17, 2006 at 10:58:55AM -0500, Chris Kees wrote:
David,
Thanks. That got me part of the way through along with similar g+ + and gfortran wrappers like what you gave me. That's nuts that those options are hardwired in. Now I'm getting more link errors because it's trying to build shared libraries without any of the options needed to build them from python extension modules:
gfortran-wrapper -m32 -mpowerpc -maltivec -framework Accelerate build/ temp.macosx-10.4-fat-2.4/Lib/integrate/_quadpackmodule.o -L/usr/local/ lib/gcc/powerpc-apple-darwin8.7.0/4.2.0 -Lbuild/temp.macosx-10.4- fat-2.4 -lquadpack -llinpack_lite -lmach -lgfortran -o build/ lib.macosx-10.4-fat-2.4/scipy/integrate/_quadpack.so /usr/bin/ld: Undefined symbols: _PyArg_ParseTuple _PyCObject_AsVoidPtr _PyCObject_Type
Hmm, that looks like it's trying to make a program. You shouldn't need a gfortran wrapper, as everything for the Fortran compiler you can override (b/c we wrote that as part of numpy.distutils; the C part comes from Python distutils). I have this in my ~/.pydistutils.cfg so I don't have to remember to set environmet variables or add command-line switches: [config_fc] fcompiler=gnu95 f77exec=gfortran-dp-4.2 f90exec=gfortran-dp-4.2 opt = -g -Wall -O3 If you're on PPC, I'd suggest still using g77 3.4 (you can grab a copy from http://hpc.sourceforge.net/).
FYI, apple's latest default compiler (4.0.1) builds numpy without any trouble on both my intel and power pc macs and all the tests pass, contrary to what I was seeing using gcc 3.3.
I build scipy with Apple's gcc 4.0.1, but with gfortran 4.2. And 3.3 is *only* for PPC, anyways. I'm on an Intel Mac, btw. Haven't tried building scipy on my iBook for a while. I do have an idea on how to make a Universal build of Scipy for Tiger that wouldn't require you having any other libraries installed. I'll try putting it together sometime soon :) -- |>|\/|< /--------------------------------------------------------------------------\ |David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/ |cookedm@physics.mcmaster.ca
participants (2)
-
Chris Kees
-
David M. Cooke