wget: fixing compilation issue with gcc11+ on rhel7 (#30858)

This commit is contained in:
snehring 2022-06-14 11:03:02 -05:00 committed by GitHub
parent a05e729e1b
commit 37426e41cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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