<div dir="ltr"><div>I will open an MR then</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno mar 23 mar 2021 alle ore 22:42 Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 23, 2021 at 1:15 PM Junchao Zhang <<a href="mailto:junchao.zhang@gmail.com" target="_blank">junchao.zhang@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Can we combine CXXPPFLAGS and CXXFLAGS into one CXXFLAGS?<br clear="all"><div><div dir="ltr"><div dir="ltr"></div></div></div></div></blockquote><div><br></div><div>No. There are compiler-only flags.</div><div><br></div><div>  Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div dir="ltr"><div dir="ltr">--Junchao Zhang</div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 23, 2021 at 11:38 AM Patrick Sanan <<a href="mailto:patrick.sanan@gmail.com" target="_blank">patrick.sanan@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>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: <div><div><a href="https://gitlab.com/petsc/petsc/-/merge_requests/3600" target="_blank">https://gitlab.com/petsc/petsc/-/merge_requests/3600</a></div><div><br></div><div><br></div><div>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. </div><div><br><div><br><blockquote type="cite"><div>Am 23.03.2021 um 17:04 schrieb Stefano Zampini <<a href="mailto:stefano.zampini@gmail.com" target="_blank">stefano.zampini@gmail.com</a>>:</div><br><div><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" target="_blank">balay@mcs.anl.gov</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);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>
<a href="http://LINK.cc" target="_blank">LINK.cc</a> = $(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" rel="noreferrer" target="_blank">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>
</div></blockquote></div><br></div></div></div></blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">Stefano</div>