[petsc-users] Cannot find a C preprocessor OSX

Satish Balay balay at mcs.anl.gov
Sat Mar 19 12:09:20 CDT 2016


On Sat, 19 Mar 2016, Satish Balay wrote:

> On Sat, 19 Mar 2016, Matthew Knepley wrote:
> 
> > On Sat, Mar 19, 2016 at 11:49 AM, Satish Balay <balay at mcs.anl.gov> wrote:
> > 
> > > On Sat, 19 Mar 2016, Matthew Knepley wrote:
> > >
> > > > On Sat, Mar 19, 2016 at 11:29 AM, Satish Balay <balay at mcs.anl.gov>
> > > wrote:
> > > >
> > > > > This code is a bit convoluted..
> > > > >
> > > > > There is CPP, CPPFLAGS, CXXCPP, CXXCPPFLAGS. But then no FPP or
> > > FPPFLAGS..
> > > > >
> > > >
> > > > Is this really true? Is the Fortran preprocessors not the C
> > > preprocessor? I
> > > > have never encountered this.
> > > > If you want flags which are different for C, use CFLAGS. Am I missing
> > > > something?
> > >
> > > Even if we assume CPPFLAGS are -D only - it wont' work with all FC
> > > compilers.  For ex: xlf does not recognize -D option - its -WF,-D.
> > > So we cannont assume FC always uses CPP [or CPPFLAGS]
> > >
> > > And some flags have to be used at compile time only - and some can be
> > > used at both compile & linktime - and some at linktime only.
> > >
> > > So we have CPPFLAGS, CFLAGS, LDFLAGS [not compiler specific?]
> > >
> > > In this case -Qunused-arguments can go into CFLAGS - but presumably
> > > there are other compiler flags that cannot be used at link time - so
> > > have to use with CPPFLAGS only?
> > >
> > > And this whole thread started with clang barfing on using a link flag
> > > during compile time..
> > >
> > > Executing:
> > > /Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/openmpi-1.10.2-37xieeupgsteaq6btru6wmhxfi44xqtn/bin/mpicc
> > > -c -o
> > >
> > > /var/folders/5k/sqpp24tx3ylds4fgm13pfht00000gn/T/petsc-8RPaEA/config.setCompilers/conftest.o
> > >
> > > -I/var/folders/5k/sqpp24tx3ylds4fgm13pfht00000gn/T/petsc-8RPaEA/config.setCompilers
> > >
> > > /var/folders/5k/sqpp24tx3ylds4fgm13pfht00000gn/T/petsc-8RPaEA/config.setCompilers/conftest.c
> > > Possible ERROR while running compiler:
> > > stderr:
> > > clang: warning: argument unused during compilation:
> > >
> > > '-L/Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/boost-1.60.0-eo7nn3v27nxa7lxqv5tttjzikshwt56i/lib'
> > > clang: warning: argument unused during compilation:
> > >
> > > '-L/Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/bzip2-1.0.6-leelnsg3humpngfeofkrdpgtsofrm5ya/lib'
> > > clang: warning: argument unused during compilation:
> > >
> > > '-L/Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/openmpi-1.10.2-37xieeupgsteaq6btru6wmhxfi44xqtn/lib'
> > >
> > >
> > > So having proper support for CFLAGS, CPPFLAGS, FLAGS, FPPFLAGS might be
> > > the correct thing to do..
> > 
> > 
> > Won't that be incredibly confusing for the 99% of people who use Fortran
> > that uses the C preprocessor?
> 
> I don't see how. We use CPPFLAGS, FPPFLAGS separatey in our makefiles [presumably petsc users
> using petscmakefile format are already using this notation..]
> 
> I think you are thinking more in terms of CPP vs FPP [CPPFLAGS vs FPPFLAGS]. I'm thinking more
> in terms of 'cc -c [CPPFLAGS]' and 'fc -c [FPPFLAGS'] - which are how the compile targets
> use these flags..

gnumake appears to use CPPFLAGS with FC :(

balay at asterix /home/balay/junk
$ touch makefile
balay at asterix /home/balay/junk
$ make -p |grep PREPROCESS
make: *** No targets.  Stop.
PREPROCESS.F = $(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -F
PREPROCESS.r = $(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F
PREPROCESS.S = $(CC) -E $(CPPFLAGS)
             $(PREPROCESS.F) $(OUTPUT_OPTION) $<
             $(PREPROCESS.r) $(OUTPUT_OPTION) $<
             $(PREPROCESS.S) $< > $@
             $(PREPROCESS.r) $(OUTPUT_OPTION) $<
             $(PREPROCESS.S) $< > $@
             $(PREPROCESS.F) $(OUTPUT_OPTION) $<

Satish

> 
> Satish
> 
> > 
> >    Matt
> > 
> > 
> > >
> > > Satish
> > >
> > > >
> > > >    Matt
> > > >
> > > >
> > > > > And then base.py has: [which is wrong for 'Cxx', 'FC'?]
> > > > >
> > > > >   def getPreprocessorFlagsName(self, language):
> > > > >     if language in ['C', 'Cxx', 'FC']:
> > > > >       flagsArg = 'CPPFLAGS'
> > > > >     elif language == 'CUDA':
> > > > >       flagsArg = 'CUDAPPFLAGS'
> > > > >     else:
> > > > >       raise RuntimeError('Unknown language: '+language)
> > > > >     return flagsArg
> > > > >
> > > > > And config/compile/FC.py has [which reuses CPP,CPPFLAGS for FC]:
> > > > >
> > > > > class Preprocessor(config.compile.C.Preprocessor):
> > > > >   '''The Fortran preprocessor, which now is just the C preprocessor'''
> > > > >   def __init__(self, argDB):
> > > > >     config.compile.C.Preprocessor.__init__(self, argDB)
> > > > >
> > > > > Matt - should we have FPP,FPPFLAGS supported here?
> > > > >
> > > > > Perhaps using CPPFLAGS with FC is a bug? So we should atleast do:
> > > > >
> > > > > diff --git a/config/BuildSystem/config/compile/FC.py
> > > > > b/config/BuildSystem/config/compile/FC.py
> > > > > index 3d0bf74..7bae24d 100644
> > > > > --- a/config/BuildSystem/config/compile/FC.py
> > > > > +++ b/config/BuildSystem/config/compile/FC.py
> > > > > @@ -13,6 +13,7 @@ class Preprocessor(config.compile.C.Preprocessor):
> > > > >      config.compile.C.Preprocessor.__init__(self, argDB)
> > > > >      self.language        = 'FC'
> > > > >      self.targetExtension = '.F'
> > > > > +    self.flagsName       = ''
> > > > >      self.includeDirectories = sets.Set()
> > > > >      return
> > > > >
> > > > > And then [I'm not sure where this gets used..]
> > > > >
> > > > > $ git diff config/BuildSystem/config/base.py |cat
> > > > > diff --git a/config/BuildSystem/config/base.py
> > > > > b/config/BuildSystem/config/base.py
> > > > > index b18a173..8b1129d 100644
> > > > > --- a/config/BuildSystem/config/base.py
> > > > > +++ b/config/BuildSystem/config/base.py
> > > > > @@ -454,8 +454,12 @@ class Configure(script.Script):
> > > > >
> > > > >    # Should be static
> > > > >    def getPreprocessorFlagsName(self, language):
> > > > > -    if language in ['C', 'Cxx', 'FC']:
> > > > > +    if language == 'C':
> > > > >        flagsArg = 'CPPFLAGS'
> > > > > +    elif language == 'Cxx':
> > > > > +      flagsArg = 'CXXCPPFLAGS'
> > > > > +    elif language == 'FC':
> > > > > +      flagsArg = ''
> > > > >      elif language == 'CUDA':
> > > > >        flagsArg = 'CUDAPPFLAGS'
> > > > >      else:
> > > > >
> > > > >
> > > > > Satish
> > > > >
> > > > > On Sat, 19 Mar 2016, Denis Davydov wrote:
> > > > >
> > > > > > Hi Satish,
> > > > > >
> > > > > > I think you have a bug in you config system as
> > > > > "CPPFLAGS=-Qunused-arguments" propagate to fortran compiler even when
> > > I try
> > > > > to explicitly specify "FPPFLAGS=" to nothing :
> > > > > >
> > > > > > TEST checkFortranCompiler from
> > > > >
> > > config.setCompilers(/private/var/folders/5k/sqpp24tx3ylds4fgm13pfht00000gn/T/davydden/spack-stage/spack-stage-jNBTET/petsc-3.6.3/config/BuildSystem/config/setCompilers.py:919)
> > > > > > TESTING: checkFortranCompiler from
> > > > >
> > > config.setCompilers(/private/var/folders/5k/sqpp24tx3ylds4fgm13pfht00000gn/T/davydden/spack-stage/spack-stage-jNBTET/petsc-3.6.3/config/BuildSystem/config/setCompilers.py:919)
> > > > > >   Locate a functional Fortran compiler
> > > > > > Checking for program
> > > > >
> > > /Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/openmpi-1.10.2-37xieeupgsteaq6btru6wmhxfi44xqtn/bin/mpif90...found
> > > > > >                 Defined make macro "FC" to
> > > > >
> > > "/Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/openmpi-1.10.2-37xieeupgsteaq6btru6wmhxfi44xqtn/bin/mpif90"
> > > > > >                 Pushing language FC
> > > > > > Executing:
> > > > >
> > > /Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/openmpi-1.10.2-37xieeupgsteaq6btru6wmhxfi44xqtn/bin/mpif90
> > > > > -c -o
> > > > >
> > > /var/folders/5k/sqpp24tx3ylds4fgm13pfht00000gn/T/petsc-zwyqnZ/config.setCompilers/conftest.o
> > > > >
> > > -I/var/folders/5k/sqpp24tx3ylds4fgm13pfht00000gn/T/petsc-zwyqnZ/config.setCompilers
> > > > > -Qunused-arguments
> > > > >
> > > /var/folders/5k/sqpp24tx3ylds4fgm13pfht00000gn/T/petsc-zwyqnZ/config.setCompilers/conftest.F
> > > > > > Possible ERROR while running compiler: exit code 256
> > > > > > stderr:
> > > > > > gfortran: error: unrecognized command line option
> > > '-Qunused-arguments’
> > > > > >
> > > > > > Kind regards,
> > > > > > Denis
> > > > > >
> > > > > > > On 18 Mar 2016, at 19:13, Satish Balay <balay at mcs.anl.gov> wrote:
> > > > > > >
> > > > > > > Or you can workarround by using additional PETSc configure option:
> > > > > > >
> > > > > > > CPPFLAGS=-Qunused-arguments
> > > > > > > [or CFLAGS?]
> > > > > > >
> > > > > > > Satish
> > > > > > >
> > > > > > >
> > > > > > > On Fri, 18 Mar 2016, Satish Balay wrote:
> > > > > > >
> > > > > > >> your mpicc is barfing stuff on stderr - thus confusing petsc
> > > > > configure.
> > > > > > >>
> > > > > > >> I don't see this issue with the old openmpi I have access to..
> > > > > > >>
> > > > > > >> What do you have for:
> > > > > > >>
> > > > > > >>
> > > > >
> > > /Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/openmpi-1.10.2-37xieeupgsteaq6btru6wmhxfi44xqtn/bin/mpicc
> > > > > -show
> > > > > > >> touch foo.c
> > > > > > >>
> > > > >
> > > /Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/openmpi-1.10.2-37xieeupgsteaq6btru6wmhxfi44xqtn/bin/mpicc
> > > > > -c foo.c -show
> > > > > > >>
> > > > > > >> I'm not sure what to suggest.. Perhaps you can use
> > > --download-mpich
> > > > > > >> [or --download-openmpi] - but then I see you are building all
> > > these
> > > > > > >> packages using spack - so perhaps you should check with 'spack'
> > > folk..
> > > > > > >>
> > > > > > >> Satish
> > > > > > >>
> > > > > > >> ---------
> > > > > > >>
> > > > > > >> Executing:
> > > > >
> > > /Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/openmpi-1.10.2-37xieeupgsteaq6btru6wmhxfi44xqtn/bin/mpicc
> > > > > -c -o
> > > > >
> > > /var/folders/5k/sqpp24tx3ylds4fgm13pfht00000gn/T/petsc-8RPaEA/config.setCompilers/conftest.o
> > > > >
> > > -I/var/folders/5k/sqpp24tx3ylds4fgm13pfht00000gn/T/petsc-8RPaEA/config.setCompilers
> > > > >
> > > /var/folders/5k/sqpp24tx3ylds4fgm13pfht00000gn/T/petsc-8RPaEA/config.setCompilers/conftest.c
> > > > > > >> Possible ERROR while running compiler:
> > > > > > >> stderr:
> > > > > > >> clang: warning: argument unused during compilation:
> > > > >
> > > '-L/Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/boost-1.60.0-eo7nn3v27nxa7lxqv5tttjzikshwt56i/lib'
> > > > > > >> clang: warning: argument unused during compilation:
> > > > >
> > > '-L/Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/bzip2-1.0.6-leelnsg3humpngfeofkrdpgtsofrm5ya/lib'
> > > > > > >> clang: warning: argument unused during compilation:
> > > > >
> > > '-L/Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/openmpi-1.10.2-37xieeupgsteaq6btru6wmhxfi44xqtn/lib'
> > > > > > >> clang: warning: argument unused during compilation:
> > > > >
> > > '-L/Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/hwloc-1.11.2-pxsmp4nhfdjc3jb7odj5lhppu7wqna5b/lib'
> > > > > > >> clang: warning: argument unused during compilation:
> > > > >
> > > '-L/Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/libpciaccess-0.13.4-erc6tr3ghndi5ed3gbj6wtvw6zl4vobf/lib'
> > > > > > >> clang: warning: argument unused during compilation:
> > > > >
> > > '-L/Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/zlib-1.2.8-cyvcqvrzlgurne424y55hxvfucvz2354/lib'
> > > > > > >> clang: warning: argument unused during compilation:
> > > > >
> > > '-L/Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/hdf5-1.8.16-diujq2w7ew4qviquh67b3lkcqsxtf77y/lib'
> > > > > > >> clang: warning: argument unused during compilation:
> > > > >
> > > '-L/Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/hypre-2.10.1-4kql32qmjpp7ict2qczkyyv6a4mbrgbl/lib'
> > > > > > >> clang: warning: argument unused during compilation:
> > > > >
> > > '-L/Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/openblas-0.2.16-qplsxnxlbaqnz2iltdo7fdhlayvuaxel/lib'
> > > > > > >> clang: warning: argument unused during compilation:
> > > > >
> > > '-L/Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/metis-5.1.0-i5y5b6r5ca4f77u5tketagpkn6joxasp/lib'
> > > > > > >> clang: warning: argument unused during compilation:
> > > > >
> > > '-L/Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/ncurses-6.0-sabhdwxbdbbapfo6wodglfmyo6u3c3hj/lib'
> > > > > > >> clang: warning: argument unused during compilation:
> > > > >
> > > '-L/Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/openssl-1.0.2g-answvmhu3lodpmgulgzryygkkimmsn34/lib'
> > > > > > >> clang: warning: argument unused during compilation:
> > > > >
> > > '-L/Users/davydden/spack/opt/spack/darwin-x86_64/clang-7.0.2-apple/parmetis-4.0.3-auubrjcwhqmqnpoqjwgwgz4bcjnxzunx/lib'
> > > > > > >>
> > > > > > >> On Fri, 18 Mar 2016, Denis Davydov wrote:
> > > > > > >>
> > > > > > >>> Dear all,
> > > > > > >>>
> > > > > > >>> Although I saw this issue on the mailing list, that was related
> > > to
> > > > > broken compilers, i don’t think it’s the case here as `mpicc -E` seems
> > > to
> > > > > be ok.
> > > > > > >>> Log is attached.
> > > > > > >>>
> > > > > > >>> Kind regards,
> > > > > > >>> Denis
> > > > > > >>>
> > > > > > >>>
> > > > > > >>
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > 
> > 
> > 
> > 
> 


More information about the petsc-users mailing list