summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMosè Giordano <giordano@users.noreply.github.com>2023-03-01 15:14:42 +0000
committerGitHub <noreply@github.com>2023-03-01 07:14:42 -0800
commit4a24401ed0a427a6effc238a507007930005393c (patch)
tree17eeb52e8f71dae70d11fb8bcbd0055a9a5490be
parent2796794b19f28bf460c3a3bab10078840d23fc45 (diff)
downloadspack-4a24401ed0a427a6effc238a507007930005393c.tar.gz
spack-4a24401ed0a427a6effc238a507007930005393c.tar.bz2
spack-4a24401ed0a427a6effc238a507007930005393c.tar.xz
spack-4a24401ed0a427a6effc238a507007930005393c.zip
wrf: Fix compilation with GCC 10+ (#35177)
Flags `-fallow-argument-mismatch -fallow-invalid-boz` set in `FFLAGS`/`FCFLAGS` environment variables don't really have effect in older versions of WRF, we need to force them in the compiler wrappers. Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
-rw-r--r--var/spack/repos/builtin/packages/wrf/package.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/wrf/package.py b/var/spack/repos/builtin/packages/wrf/package.py
index f197d9b956..1318a4367d 100644
--- a/var/spack/repos/builtin/packages/wrf/package.py
+++ b/var/spack/repos/builtin/packages/wrf/package.py
@@ -229,7 +229,10 @@ class Wrf(Package):
env.set("JASPERINC", self.spec["jasper"].prefix.include)
env.set("JASPERLIB", self.spec["jasper"].prefix.lib)
- if self.spec.satisfies("%gcc@10:"):
+ # These flags should be used also in v3, but FCFLAGS/FFLAGS aren't used
+ # consistently in that version of WRF, so we have to force them through
+ # `flag_handler` below.
+ if self.spec.satisfies("@4.0: %gcc@10:"):
args = "-w -O2 -fallow-argument-mismatch -fallow-invalid-boz"
env.set("FCFLAGS", args)
env.set("FFLAGS", args)
@@ -239,6 +242,13 @@ class Wrf(Package):
env.set("HDF5", self.spec["hdf5"].prefix)
env.prepend_path("PATH", ancestor(self.compiler.cc))
+ def flag_handler(self, name, flags):
+ # Same flags as FCFLAGS/FFLAGS above, but forced through the compiler
+ # wrapper when compiling v3.9.1.1.
+ if self.spec.satisfies("@3.9.1.1 %gcc@10:") and name == "fflags":
+ flags.extend(["-w", "-O2", "-fallow-argument-mismatch", "-fallow-invalid-boz"])
+ return (flags, None, None)
+
def patch(self):
# Let's not assume csh is intalled in bin
files = glob.glob("*.csh")