From 3039237a0e7cee898d85a33b13ed6d5ab712b3f3 Mon Sep 17 00:00:00 2001 From: Paul Henning <40867327+pjh40@users.noreply.github.com> Date: Tue, 22 Jun 2021 00:36:28 -0600 Subject: hdf5: fix compiler detection in flag_handler (#24451) The original implementation of `flag_handler` searched the `self.compiler.cc` string for `clang` or `gcc` in order to add a flag for those compilers. This approach fails when using a spack-installed compiler that was itself built with gcc or clang, as those strings will appear in the fully-qualified compiler executable paths. This commit switches to searching for `%gcc` or `%clang` in `self.spec`. Co-authored-by: Paul Henning --- var/spack/repos/builtin/packages/hdf5/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/hdf5/package.py b/var/spack/repos/builtin/packages/hdf5/package.py index 6c80b78e0d..0aa7e5b730 100644 --- a/var/spack/repos/builtin/packages/hdf5/package.py +++ b/var/spack/repos/builtin/packages/hdf5/package.py @@ -185,7 +185,7 @@ class Hdf5(AutotoolsPackage): # Quiet warnings/errors about implicit declaration of functions in C99 if name == "cflags": - if "clang" in self.compiler.cc or "gcc" in self.compiler.cc: + if "%clang" in self.spec or "%gcc" in self.spec: flags.append("-Wno-implicit-function-declaration") return (None, None, flags) -- cgit v1.2.3-70-g09d2