<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">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 class=""><div class=""><a href="https://gitlab.com/petsc/petsc/-/merge_requests/3600" class="">https://gitlab.com/petsc/petsc/-/merge_requests/3600</a></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">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 class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">Am 23.03.2021 um 17:04 schrieb Stefano Zampini <<a href="mailto:stefano.zampini@gmail.com" class="">stefano.zampini@gmail.com</a>>:</div><br class="Apple-interchange-newline"><div class=""><div dir="auto" class="">The check fails within buildsystem when <span style="font-family:sans-serif" class="">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 class=""><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" class="">balay@mcs.anl.gov</a>> ha scritto:<br class=""></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 class="">
also needed at pre-process stage and/or at link stage.<br class="">
<br class="">
And for compile stage both CXXFLAGS and CXXPPFLAGS should get<br class="">
used. [PETSc makefiles make sure this is the case]<br class="">
<br class="">
And for link stage CXXFLAGS and LDFLAGS get used [but then sometimes<br class="">
we have CLINKER, and FLINKER - and they certainly don't use CXXFLAGS -<br class="">
so -std=cxx11 isn't really needed at link time?<br class="">
<br class="">
So the previous default of CXXPPFLAGS=-std=cxx11 looks reasonable to me.<br class="">
<br class="">
However if this project is not using PETSc makefiles - it should make sure all compile flags are grabbed.<br class="">
<br class="">
# lib/petsc/conf/variables<br class="">
PETSC_CXXCPPFLAGS = ${PETSC_CC_INCLUDES} ${PETSCFLAGS} ${CXXPP_FLAGS} ${CXXPPFLAGS}<br class="">
CXXCPPFLAGS = ${PETSC_CXXCPPFLAGS}<br class="">
PETSC_CXXCOMPILE_SINGLE = ${CXX} -o $*.o -c ${CXX_FLAGS} ${CXXFLAGS} ${CXXCPPFLAGS}<br class="">
<br class="">
# lib/petsc/conf/rules<br class="">
.cpp.o .cxx.o .cc.o .C.o:<br class="">
${PETSC_CXXCOMPILE_SINGLE} `pwd`/$<<br class="">
<br class="">
# gmakefile.test<br class="">
PETSC_COMPILE.cxx = $(call quiet,CXX) -c $(CXX_FLAGS) $(CXXFLAGS) $(CXXCPPFLAGS) $(CXX_DEPFLAGS)<br class="">
<br class="">
# lib/petsc/conf/test<br class="">
<a href="http://LINK.cc" class="">LINK.cc</a> = $(CXXLINKER) $(CXX_FLAGS) $(CXXFLAGS) $(CXXCPPFLAGS) $(LDFLAGS)<br class="">
<br class="">
Satish<br class="">
<br class="">
<br class="">
On Tue, 23 Mar 2021, Junchao Zhang wrote:<br class="">
<br class="">
> I would rather directly change the project to use CXXFLAGS instead of<br class="">
> CXXPPFLAGS.<br class="">
> <br class="">
> --Junchao Zhang<br class="">
> <br class="">
> <br class="">
> On Tue, Mar 23, 2021 at 10:01 AM Satish Balay via petsc-dev <<br class="">
> <a href="mailto:petsc-dev@mcs.anl.gov" target="_blank" rel="noreferrer" class="">petsc-dev@mcs.anl.gov</a>> wrote:<br class="">
> <br class="">
> > On Tue, 23 Mar 2021, Stefano Zampini wrote:<br class="">
> ><br class="">
> > > Just tried out of main, and and the include tests of a c++11 project fail<br class="">
> > > Below my fix, if we agree on, I'll make a MR<br class="">
> > ><br class="">
> > > diff --git a/config/BuildSystem/config/compilers.py<br class="">
> > > b/config/BuildSystem/config/compilers.py<br class="">
> > > index c96967e..44e4657 100644<br class="">
> > > --- a/config/BuildSystem/config/compilers.py<br class="">
> > > +++ b/config/BuildSystem/config/compilers.py<br class="">
> > > @@ -527,6 +527,8 @@ class Configure(config.base.Configure):<br class="">
> > > if self.setCompilers.checkCompilerFlag(flag, includes,<br class="">
> > > body+body14):<br class="">
> > > newflag = getattr(self.setCompilers,LANG+'FLAGS') + ' ' +<br class="">
> > flag #<br class="">
> > > append flag to the old<br class="">
> > > setattr(self.setCompilers,LANG+'FLAGS',newflag)<br class="">
> > > + newflag = getattr(self.setCompilers,LANG+'PPFLAGS') + ' ' +<br class="">
> > flag<br class="">
> > > # append flag to the old<br class="">
> > > + setattr(self.setCompilers,LANG+'PPFLAGS',newflag)<br class="">
> ><br class="">
> ><br class="">
> > <a href="https://gitlab.com/petsc/petsc/commit/ead1aa4045d7bca177e78933b9ca25145fc3c574" rel="noreferrer noreferrer" target="_blank" class="">https://gitlab.com/petsc/petsc/commit/ead1aa4045d7bca177e78933b9ca25145fc3c574</a><br class="">
> ><br class="">
> > self.setCompilers.CXXPPFLAGS += ' ' + flag<br class="">
> > newflag = getattr(self.setCompilers,LANG+'FLAGS') + ' ' + flag #<br class="">
> > append flag to the old<br class="">
> > setattr(self.setCompilers,LANG+'FLAGS',newflag)<br class="">
> ><br class="">
> > So the old code was setting 'PPFLAGS' - but this commit changed to<br class="">
> > 'FLAGS'. Maybe this flag is needed at both compile time and link time?<br class="">
> ><br class="">
> > So this project is somehow using CXXPPFLAGS - but not CXXFLAGS?<br class="">
> ><br class="">
> > I'm fine with adding it to PPFLAGS - duplicate listing hopefully shouldn't<br class="">
> > cause grief.<br class="">
> ><br class="">
> > Satish<br class="">
> ><br class="">
> > > cxxdialect = 'C++14'<br class="">
> > > self.addDefine('HAVE_'+LANG+'_DIALECT_CXX14',1)<br class="">
> > > self.addDefine('HAVE_'+LANG+'_DIALECT_CXX11',1)<br class="">
> > > @@ -546,6 +548,8 @@ class Configure(config.base.Configure):<br class="">
> > > if self.setCompilers.checkCompilerFlag(flag, includes, body):<br class="">
> > > newflag = getattr(self.setCompilers,LANG+'FLAGS') + ' ' +<br class="">
> > flag #<br class="">
> > > append flag to the old<br class="">
> > > setattr(self.setCompilers,LANG+'FLAGS',newflag)<br class="">
> > > + newflag = getattr(self.setCompilers,LANG+'PPFLAGS') + ' ' +<br class="">
> > flag<br class="">
> > > # append flag to the old<br class="">
> > > + setattr(self.setCompilers,LANG+'PPFLAGS',newflag)<br class="">
> > > cxxdialect = 'C++11'<br class="">
> > > self.addDefine('HAVE_'+LANG+'_DIALECT_CXX11',1)<br class="">
> > > break<br class="">
> > ><br class="">
> > ><br class="">
> > ><br class="">
> ><br class="">
> ><br class="">
> <br class="">
<br class="">
</blockquote></div>
</div></blockquote></div><br class=""></div></div></body></html>