From 308f016f31fda65c50534ef351cc4f7a6405c03d Mon Sep 17 00:00:00 2001 From: Michael Kuhn Date: Wed, 13 May 2020 16:44:50 +0200 Subject: [PATCH] parallel-netcdf: fix build with gcc@10: (#16620) --- .../packages/parallel-netcdf/package.py | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/var/spack/repos/builtin/packages/parallel-netcdf/package.py b/var/spack/repos/builtin/packages/parallel-netcdf/package.py index dc2f1b4ac3..722efab16e 100644 --- a/var/spack/repos/builtin/packages/parallel-netcdf/package.py +++ b/var/spack/repos/builtin/packages/parallel-netcdf/package.py @@ -95,13 +95,27 @@ def configure_args(self): args += self.enable_or_disable('cxx') args += self.enable_or_disable('fortran') + flags = { + 'CFLAGS': [], + 'CXXFLAGS': [], + 'FFLAGS': [], + 'FCFLAGS': [], + } + if '+pic' in self.spec: - args.extend([ - 'CFLAGS=' + self.compiler.cc_pic_flag, - 'CXXFLAGS=' + self.compiler.cxx_pic_flag, - 'FFLAGS=' + self.compiler.f77_pic_flag, - 'FCFLAGS=' + self.compiler.fc_pic_flag, - ]) + flags['CFLAGS'].append(self.compiler.cc_pic_flag) + flags['CXXFLAGS'].append(self.compiler.cxx_pic_flag) + flags['FFLAGS'].append(self.compiler.f77_pic_flag) + flags['FCFLAGS'].append(self.compiler.fc_pic_flag) + + # https://github.com/Parallel-NetCDF/PnetCDF/issues/61 + if self.spec.satisfies('%gcc@10:'): + flags['FFLAGS'].append('-fallow-argument-mismatch') + flags['FCFLAGS'].append('-fallow-argument-mismatch') + + for key, value in sorted(flags.items()): + if value: + args.append('{0}={1}'.format(key, ' '.join(value))) if self.version >= Version('1.8'): args.append('--enable-relax-coord-bound')