Hi, I already have had the same kind of problem and here is the answer I got from Barry Smith :
This happens because the BuildSystem inherits the bad feature of autoconf that checks for functions using the C compiler even when the C++ compiler will be used to actually compile the package. Edit $PETSC_ARCH/include/petscconf.h and remove the lines #ifndef PETSC_HAVE_ISINF #define PETSC_HAVE_ISINF 1 #endif #ifndef PETSC_HAVE_ISNAN #define PETSC_HAVE_ISNAN 1 #endif DO NOT rerun config/configure.py just do the make all again. Barry -- David Colignon, Ph.D. Collaborateur Logistique du F.R.S.-FNRS C?CI - Consortium des ?quipements de Calcul Intensif ACE - Applied & Computational Electromagnetics Sart-Tilman B28 Universit? de Li?ge 4000 Li?ge - BELGIQUE T?l: +32 (0)4 366 37 32 Fax: +32 (0)4 366 29 10 WWW: http://hpc.montefiore.ulg.ac.be/ Agenda: http://www.google.com/calendar/embed?src=david.colignon%40gmail.com Niall Moran wrote: > Hi, > > I am trying to compile petsc on snow leopard. I need to have complex > support and support for C++. I am using the gcc and g++ compilers that > come packaged with the developers tools > > i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646) > Copyright (C) 2007 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > and the gfortran compiler from http://hpc.sourceforge.net/. The > configuration file I am using is > > #!/usr/bin/env python > > configure_options = [ > '--FFLAGS=-m64', > '--CFLAGS=-m64', > '--CXXFLAGS=-m64', > '--LDFLAGS=-L/usr/lib', > '--with-python=0', > '--with-shared=0', > '--with-dynamic=0', > '--with-mpi-dir=/Users/nmoran/local/openmpi', > '--with-clanguage=C++', > '--with-scalar-type=complex', > '--with-debugging=yes', > '--with-gcov=0' > ] > > if __name__ == '__main__': > import sys,os > sys.path.insert(0,os.path.abspath('config')) > import configure > configure.petsc_configure(configure_options) > > > I am getting errors that the macros isinf and isnan cannot be found in > the scope for various files. The first one listed is > src/sys/ftn-custom/zutils.c on the lines > > return (PetscTruth) PetscIsInfOrNanScalar(*v); > and > return (PetscTruth) PetscIsInfOrNanReal(*v); > > These macros are defined in /usr/include/architecture/i386/math.h. No > errors are found if scalar-type is real. It seems the #include<complex> > somehow undefines these macros. I have got petsc to compile by > redefining these macros at the top of each of the problem files but this > is not a very elegant solution. > > Regards. > > Niall.