From 37426e41cb14f6f50cf2cae89d1c0420a2f6c6dd Mon Sep 17 00:00:00 2001 From: snehring <7978778+snehring@users.noreply.github.com> Date: Tue, 14 Jun 2022 11:03:02 -0500 Subject: [PATCH] wget: fixing compilation issue with gcc11+ on rhel7 (#30858) --- var/spack/repos/builtin/packages/wget/package.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/var/spack/repos/builtin/packages/wget/package.py b/var/spack/repos/builtin/packages/wget/package.py index cb3f64cf3e..511ab1375a 100644 --- a/var/spack/repos/builtin/packages/wget/package.py +++ b/var/spack/repos/builtin/packages/wget/package.py @@ -53,6 +53,16 @@ class Wget(AutotoolsPackage, GNUMirrorPackage): build_directory = 'spack-build' + def flag_handler(self, name, flags): + # gcc11 defaults to c17, which breaks compilation with older + # glibc versions as shipped with rhel7 and likely other OS + # versions too, feel free to add as necessary + older_glibc = self.spec.satisfies('os=rhel7') or \ + self.spec.satisfies('os=centos7') + if self.spec.satisfies('%gcc@11:') and older_glibc and name.lower() == 'cflags': + flags.append(self.compiler.c11_flag) + return (None, None, flags) + def configure_args(self): spec = self.spec