[petsc-dev] configureLibrary fails for c++11 projects

Satish Balay balay at mcs.anl.gov
Tue Mar 23 10:01:03 CDT 2021


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
> 
> 
> 



More information about the petsc-dev mailing list