<div dir="auto">The check fails within buildsystem when <span style="font-family:sans-serif">running mpicc -E (which uses CXXPPFLAGS) </span> The package header needs c++11  to be included properly. C++11 is also needed at preprocessing time</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il Mar 23 Mar 2021, 18:59 Satish Balay <<a href="mailto:balay@mcs.anl.gov">balay@mcs.anl.gov</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">-std=cxx11 for sure is a compile flag. But don't really know if its<br>
also needed at pre-process stage and/or at link stage.<br>
<br>
And for compile stage both CXXFLAGS and CXXPPFLAGS should get<br>
used. [PETSc makefiles make sure this is the case]<br>
<br>
And for link stage CXXFLAGS and LDFLAGS get used [but then sometimes<br>
we have CLINKER, and FLINKER - and they certainly don't use CXXFLAGS -<br>
so -std=cxx11 isn't really needed at link time?<br>
<br>
So the previous default of CXXPPFLAGS=-std=cxx11 looks reasonable to me.<br>
<br>
However if this project is not using PETSc makefiles - it should make sure all compile flags are grabbed.<br>
<br>
# lib/petsc/conf/variables<br>
PETSC_CXXCPPFLAGS       = ${PETSC_CC_INCLUDES} ${PETSCFLAGS} ${CXXPP_FLAGS} ${CXXPPFLAGS}<br>
CXXCPPFLAGS             = ${PETSC_CXXCPPFLAGS}<br>
PETSC_CXXCOMPILE_SINGLE = ${CXX} -o $*.o -c ${CXX_FLAGS} ${CXXFLAGS} ${CXXCPPFLAGS}<br>
<br>
# lib/petsc/conf/rules<br>
.cpp.o .cxx.o .cc.o .C.o:<br>
        ${PETSC_CXXCOMPILE_SINGLE} `pwd`/$<<br>
<br>
# gmakefile.test<br>
PETSC_COMPILE.cxx = $(call quiet,CXX) -c $(CXX_FLAGS) $(CXXFLAGS) $(CXXCPPFLAGS) $(CXX_DEPFLAGS)<br>
<br>
# lib/petsc/conf/test<br>
LINK.cc = $(CXXLINKER) $(CXX_FLAGS) $(CXXFLAGS) $(CXXCPPFLAGS) $(LDFLAGS)<br>
<br>
Satish<br>
<br>
<br>
On Tue, 23 Mar 2021, Junchao Zhang wrote:<br>
<br>
> I would rather directly change the project to use CXXFLAGS instead of<br>
> CXXPPFLAGS.<br>
> <br>
> --Junchao Zhang<br>
> <br>
> <br>
> On Tue, Mar 23, 2021 at 10:01 AM Satish Balay via petsc-dev <<br>
> <a href="mailto:petsc-dev@mcs.anl.gov" target="_blank" rel="noreferrer">petsc-dev@mcs.anl.gov</a>> wrote:<br>
> <br>
> > On Tue, 23 Mar 2021, Stefano Zampini wrote:<br>
> ><br>
> > > Just tried out of main, and and the include tests of a c++11 project fail<br>
> > > Below my fix, if we agree on, I'll make a MR<br>
> > ><br>
> > > diff --git a/config/BuildSystem/config/compilers.py<br>
> > > b/config/BuildSystem/config/compilers.py<br>
> > > index c96967e..44e4657 100644<br>
> > > --- a/config/BuildSystem/config/compilers.py<br>
> > > +++ b/config/BuildSystem/config/compilers.py<br>
> > > @@ -527,6 +527,8 @@ class Configure(config.base.Configure):<br>
> > >          if self.setCompilers.checkCompilerFlag(flag, includes,<br>
> > > body+body14):<br>
> > >            newflag = getattr(self.setCompilers,LANG+'FLAGS') + ' ' +<br>
> > flag #<br>
> > > append flag to the old<br>
> > >            setattr(self.setCompilers,LANG+'FLAGS',newflag)<br>
> > > +          newflag = getattr(self.setCompilers,LANG+'PPFLAGS') + ' ' +<br>
> > flag<br>
> > > # append flag to the old<br>
> > > +          setattr(self.setCompilers,LANG+'PPFLAGS',newflag)<br>
> ><br>
> ><br>
> > <a href="https://gitlab.com/petsc/petsc/commit/ead1aa4045d7bca177e78933b9ca25145fc3c574" rel="noreferrer noreferrer" target="_blank">https://gitlab.com/petsc/petsc/commit/ead1aa4045d7bca177e78933b9ca25145fc3c574</a><br>
> ><br>
> >           self.setCompilers.CXXPPFLAGS += ' ' + flag<br>
> >           newflag = getattr(self.setCompilers,LANG+'FLAGS') + ' ' + flag #<br>
> > append flag to the old<br>
> >           setattr(self.setCompilers,LANG+'FLAGS',newflag)<br>
> ><br>
> > So the old code was setting 'PPFLAGS' - but this commit changed to<br>
> > 'FLAGS'. Maybe this flag is needed at both compile time and link time?<br>
> ><br>
> > So this project is somehow using CXXPPFLAGS - but not CXXFLAGS?<br>
> ><br>
> > I'm fine with adding it to PPFLAGS - duplicate listing hopefully shouldn't<br>
> > cause grief.<br>
> ><br>
> > Satish<br>
> ><br>
> > >            cxxdialect = 'C++14'<br>
> > >            self.addDefine('HAVE_'+LANG+'_DIALECT_CXX14',1)<br>
> > >            self.addDefine('HAVE_'+LANG+'_DIALECT_CXX11',1)<br>
> > > @@ -546,6 +548,8 @@ class Configure(config.base.Configure):<br>
> > >          if self.setCompilers.checkCompilerFlag(flag, includes, body):<br>
> > >            newflag = getattr(self.setCompilers,LANG+'FLAGS') + ' ' +<br>
> > flag #<br>
> > > append flag to the old<br>
> > >            setattr(self.setCompilers,LANG+'FLAGS',newflag)<br>
> > > +          newflag = getattr(self.setCompilers,LANG+'PPFLAGS') + ' ' +<br>
> > flag<br>
> > > # append flag to the old<br>
> > > +          setattr(self.setCompilers,LANG+'PPFLAGS',newflag)<br>
> > >            cxxdialect = 'C++11'<br>
> > >            self.addDefine('HAVE_'+LANG+'_DIALECT_CXX11',1)<br>
> > >            break<br>
> > ><br>
> > ><br>
> > ><br>
> ><br>
> ><br>
> <br>
<br>
</blockquote></div>