Passing COPTFLAGS currently causes your flags to be passed _prior_ to the flags that get added in compilerOptions.py. This makes ./configure COPTFLAGS='-Og -g' useless since -O0 gets passed afterward, for example.
https://bitbucket.org/petsc/petsc/commits/e3218094707942d5674f57c17eb63a9af846a945 > commit e3218094707942d5674f57c17eb63a9af846a945 > Author: Barry Smith <[email protected]> > Date: Sat Mar 17 22:47:44 2012 -0500 > > added -fno-inline for better debugging with gnu compilers; take it out if > it breaks something > > Hg-commit: cee000f4e8f56981f3611284aa810e3c0419aa10 > > Modified config/compilerOptions.py > diff --git a/config/compilerOptions.py b/config/compilerOptions.py > index e619c8e..612cb3f 100644 > --- a/config/compilerOptions.py > +++ b/config/compilerOptions.py > @@ -22,6 +22,8 @@ class CompilerOptions(config.base.Configure): > if self.framework.argDB['with-gcov']: > flags.extend(['-fprofile-arcs', '-ftest-coverage']) > flags.append('-g3') > + flags.append('-fno-inline') -fno-inline Do not expand any functions inline apart from those marked with the "always_inline" attribute. This is the default when not optimizing. I.e., this option should have no effect. > + flags.append('-O0') This is the default and overrides COPTFLAGS since it comes later. I would guess this was added to compensate for MPICH putting its CFLAGS into the compiler wrappers (you need MPICHLIB_CFLAGS to avoid it), so that "mpicc somefile.c" often defaults to high optimization. That behavior is bad and I agree that we need to work around it somehow, but the fix in this patch was not applied to getCxxFlags or getFortranFlags. The way I see, it, we can exit early when the user specifies COPTFLAGS diff --git i/config/BuildSystem/config/compilerOptions.py w/config/BuildSystem/config/compilerOptions.py index dadc5fb..2a3cfa0 100644 --- i/config/BuildSystem/config/compilerOptions.py +++ w/config/BuildSystem/config/compilerOptions.py @@ -14,6 +14,9 @@ class CompilerOptions(config.base.Configure): except: pass + if bopt and 'COPTFLAGS' in self.framework.argDB: + return [] + flags = [] # GNU gcc if config.setCompilers.Configure.isGNU(compiler) or config.setCompilers.Configure.isClang(compiler): and we can add -O0 to the other languages @@ -96,6 +101,7 @@ class CompilerOptions(config.base.Configure): flags.extend(['-fprofile-arcs', '-ftest-coverage']) # -g3 causes an as SEGV on OSX flags.append('-g') + flags.append('-O0') # MPICH puts CXXFLAGS into wrappers, so ensure that we do not use optimization elif bopt in ['O']: if os.environ.has_key('USER'): flags.append('-O') (similar for Fortran). But this is also imperfect because some people use non-Gnu compilers. Is there a clean solution? > elif bopt == 'O': > flags.append('-O') > else: > Modified config/packages/MPI.py > diff --git a/config/packages/MPI.py b/config/packages/MPI.py > index 260acab..2328eb9 100644 > --- a/config/packages/MPI.py > +++ b/config/packages/MPI.py > @@ -11,7 +11,7 @@ from stat import * > class Configure(config.package.Package): > def __init__(self, framework): > config.package.Package.__init__(self, framework) > - self.download_openmpi = > ['http://www.open-mpi.org/software/ompi/v1.5/downloads/openmpi-1.5.4.tar.gz'] > + self.download_openmpi = > ['http://www.open-mpi.org/software/ompi/v1.4/downloads/openmpi-1.4.4.tar.gz'] > self.download_mpich = > ['http://www.mcs.anl.gov/research/projects/mpich2/downloads/tarballs/1.4.1p1/mpich2-1.4.1p1.tar.gz'] > self.download = ['redefine'] > self.functions = ['MPI_Init', 'MPI_Comm_create'] > >
pgpZE2ZmXv5yy.pgp
Description: PGP signature
