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>
This commit is contained in:
		| @@ -229,7 +229,10 @@ def setup_build_environment(self, env): | |||||||
|         env.set("JASPERINC", self.spec["jasper"].prefix.include) |         env.set("JASPERINC", self.spec["jasper"].prefix.include) | ||||||
|         env.set("JASPERLIB", self.spec["jasper"].prefix.lib) |         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" |             args = "-w -O2 -fallow-argument-mismatch -fallow-invalid-boz" | ||||||
|             env.set("FCFLAGS", args) |             env.set("FCFLAGS", args) | ||||||
|             env.set("FFLAGS", args) |             env.set("FFLAGS", args) | ||||||
| @@ -239,6 +242,13 @@ def setup_build_environment(self, env): | |||||||
|             env.set("HDF5", self.spec["hdf5"].prefix) |             env.set("HDF5", self.spec["hdf5"].prefix) | ||||||
|             env.prepend_path("PATH", ancestor(self.compiler.cc)) |             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): |     def patch(self): | ||||||
|         # Let's not assume csh is intalled in bin |         # Let's not assume csh is intalled in bin | ||||||
|         files = glob.glob("*.csh") |         files = glob.glob("*.csh") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Mosè Giordano
					Mosè Giordano