I will open an MR then
Il giorno mar 23 mar 2021 alle ore 22:42 Matthew Knepley <[email protected]> ha scritto: > > On Tue, Mar 23, 2021 at 1:15 PM Junchao Zhang <[email protected]> > wrote: > >> Can we combine CXXPPFLAGS and CXXFLAGS into one CXXFLAGS? >> > > No. There are compiler-only flags. > > Matt > > >> --Junchao Zhang >> >> >> On Tue, Mar 23, 2021 at 11:38 AM Patrick Sanan <[email protected]> >> wrote: >> >>> I had a related (I think) issue trying to build with Kokkos. Those >>> headers throw an #error if they're expecting OpenMP and the compiler >>> doesn't have the OpenMP flag. I have an open MR here (number 60^2!) which >>> thus adds the OpenMP flag to the CXXPPFLAGS: >>> https://gitlab.com/petsc/petsc/-/merge_requests/3600 >>> >>> >>> My collaborator at CSCS was testing with the latest Kokkos and ran into >>> an even hairier version of this problem trying to use CUDA - the Kokkos >>> headers now apparently check that you're using nvcc. He has some workaround >>> which I'll review and hopefully be able to submit. >>> >>> >>> Am 23.03.2021 um 17:04 schrieb Stefano Zampini < >>> [email protected]>: >>> >>> The check fails within buildsystem when running mpicc -E (which uses >>> CXXPPFLAGS) The package header needs c++11 to be included properly. >>> C++11 is also needed at preprocessing time >>> >>> Il Mar 23 Mar 2021, 18:59 Satish Balay <[email protected]> ha scritto: >>> >>>> -std=cxx11 for sure is a compile flag. But don't really know if its >>>> also needed at pre-process stage and/or at link stage. >>>> >>>> And for compile stage both CXXFLAGS and CXXPPFLAGS should get >>>> used. [PETSc makefiles make sure this is the case] >>>> >>>> And for link stage CXXFLAGS and LDFLAGS get used [but then sometimes >>>> we have CLINKER, and FLINKER - and they certainly don't use CXXFLAGS - >>>> so -std=cxx11 isn't really needed at link time? >>>> >>>> So the previous default of CXXPPFLAGS=-std=cxx11 looks reasonable to me. >>>> >>>> However if this project is not using PETSc makefiles - it should make >>>> sure all compile flags are grabbed. >>>> >>>> # lib/petsc/conf/variables >>>> PETSC_CXXCPPFLAGS = ${PETSC_CC_INCLUDES} ${PETSCFLAGS} >>>> ${CXXPP_FLAGS} ${CXXPPFLAGS} >>>> CXXCPPFLAGS = ${PETSC_CXXCPPFLAGS} >>>> PETSC_CXXCOMPILE_SINGLE = ${CXX} -o $*.o -c ${CXX_FLAGS} ${CXXFLAGS} >>>> ${CXXCPPFLAGS} >>>> >>>> # lib/petsc/conf/rules >>>> .cpp.o .cxx.o .cc.o .C.o: >>>> ${PETSC_CXXCOMPILE_SINGLE} `pwd`/$< >>>> >>>> # gmakefile.test >>>> PETSC_COMPILE.cxx = $(call quiet,CXX) -c $(CXX_FLAGS) $(CXXFLAGS) >>>> $(CXXCPPFLAGS) $(CXX_DEPFLAGS) >>>> >>>> # lib/petsc/conf/test >>>> LINK.cc = $(CXXLINKER) $(CXX_FLAGS) $(CXXFLAGS) $(CXXCPPFLAGS) >>>> $(LDFLAGS) >>>> >>>> Satish >>>> >>>> >>>> On Tue, 23 Mar 2021, Junchao Zhang wrote: >>>> >>>> > I would rather directly change the project to use CXXFLAGS instead of >>>> > CXXPPFLAGS. >>>> > >>>> > --Junchao Zhang >>>> > >>>> > >>>> > On Tue, Mar 23, 2021 at 10:01 AM Satish Balay via petsc-dev < >>>> > [email protected]> wrote: >>>> > >>>> > > On Tue, 23 Mar 2021, Stefano Zampini wrote: >>>> > > >>>> > > > Just tried out of main, and and the include tests of a c++11 >>>> project fail >>>> > > > Below my fix, if we agree on, I'll make a MR >>>> > > > >>>> > > > diff --git a/config/BuildSystem/config/compilers.py >>>> > > > b/config/BuildSystem/config/compilers.py >>>> > > > index c96967e..44e4657 100644 >>>> > > > --- a/config/BuildSystem/config/compilers.py >>>> > > > +++ b/config/BuildSystem/config/compilers.py >>>> > > > @@ -527,6 +527,8 @@ class Configure(config.base.Configure): >>>> > > > if self.setCompilers.checkCompilerFlag(flag, includes, >>>> > > > body+body14): >>>> > > > newflag = getattr(self.setCompilers,LANG+'FLAGS') + ' >>>> ' + >>>> > > flag # >>>> > > > append flag to the old >>>> > > > setattr(self.setCompilers,LANG+'FLAGS',newflag) >>>> > > > + newflag = getattr(self.setCompilers,LANG+'PPFLAGS') + >>>> ' ' + >>>> > > flag >>>> > > > # append flag to the old >>>> > > > + setattr(self.setCompilers,LANG+'PPFLAGS',newflag) >>>> > > >>>> > > >>>> > > >>>> https://gitlab.com/petsc/petsc/commit/ead1aa4045d7bca177e78933b9ca25145fc3c574 >>>> > > >>>> > > self.setCompilers.CXXPPFLAGS += ' ' + flag >>>> > > newflag = getattr(self.setCompilers,LANG+'FLAGS') + ' ' + >>>> flag # >>>> > > append flag to the old >>>> > > setattr(self.setCompilers,LANG+'FLAGS',newflag) >>>> > > >>>> > > So the old code was setting 'PPFLAGS' - but this commit changed to >>>> > > 'FLAGS'. Maybe this flag is needed at both compile time and link >>>> time? >>>> > > >>>> > > So this project is somehow using CXXPPFLAGS - but not CXXFLAGS? >>>> > > >>>> > > I'm fine with adding it to PPFLAGS - duplicate listing hopefully >>>> shouldn't >>>> > > cause grief. >>>> > > >>>> > > Satish >>>> > > >>>> > > > cxxdialect = 'C++14' >>>> > > > self.addDefine('HAVE_'+LANG+'_DIALECT_CXX14',1) >>>> > > > self.addDefine('HAVE_'+LANG+'_DIALECT_CXX11',1) >>>> > > > @@ -546,6 +548,8 @@ class Configure(config.base.Configure): >>>> > > > if self.setCompilers.checkCompilerFlag(flag, includes, >>>> body): >>>> > > > newflag = getattr(self.setCompilers,LANG+'FLAGS') + ' >>>> ' + >>>> > > flag # >>>> > > > append flag to the old >>>> > > > setattr(self.setCompilers,LANG+'FLAGS',newflag) >>>> > > > + newflag = getattr(self.setCompilers,LANG+'PPFLAGS') + >>>> ' ' + >>>> > > flag >>>> > > > # append flag to the old >>>> > > > + setattr(self.setCompilers,LANG+'PPFLAGS',newflag) >>>> > > > cxxdialect = 'C++11' >>>> > > > self.addDefine('HAVE_'+LANG+'_DIALECT_CXX11',1) >>>> > > > break >>>> > > > >>>> > > > >>>> > > > >>>> > > >>>> > > >>>> > >>>> >>>> >>> > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which their > experiments lead. > -- Norbert Wiener > > https://www.cse.buffalo.edu/~knepley/ > <http://www.cse.buffalo.edu/~knepley/> > -- Stefano
