summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarmen Stoppels <me@harmenstoppels.nl>2024-08-29 11:24:58 +0200
committerGitHub <noreply@github.com>2024-08-29 11:24:58 +0200
commitfe8f631b7d412a6834f6a9a921c047bf03d8b89a (patch)
treead611cebbef21460538b5d9c56161bb9efde9e0e
parentf9065f0c7e82cfb4bcef00f56bb5ae2864f5e0ec (diff)
downloadspack-fe8f631b7d412a6834f6a9a921c047bf03d8b89a.tar.gz
spack-fe8f631b7d412a6834f6a9a921c047bf03d8b89a.tar.bz2
spack-fe8f631b7d412a6834f6a9a921c047bf03d8b89a.tar.xz
spack-fe8f631b7d412a6834f6a9a921c047bf03d8b89a.zip
tau: fix (cray) compiler names/paths (#46104)
fixes a build issue on cray ci
-rw-r--r--var/spack/repos/builtin/packages/tau/package.py34
1 files changed, 15 insertions, 19 deletions
diff --git a/var/spack/repos/builtin/packages/tau/package.py b/var/spack/repos/builtin/packages/tau/package.py
index 4b944cc027..fd499910dd 100644
--- a/var/spack/repos/builtin/packages/tau/package.py
+++ b/var/spack/repos/builtin/packages/tau/package.py
@@ -204,25 +204,21 @@ class Tau(Package):
# ('CC', 'CXX' and 'FC')
# 4 - if no -cc=<compiler> -cxx=<compiler> is passed tau is built with
# system compiler silently
- # (regardless of what %<compiler> is used in the spec)
- # 5 - On cray gnu compilers are not provied by self.compilers
- # Checking GCC_PATH will work if spack loads the gcc module
- #
- # In the following we give TAU what he expects and put compilers into
- # PATH
- compiler_path = os.path.dirname(self.compiler.cc)
- if not compiler_path and self.compiler.cc_names[0] == "gcc":
- compiler_path = os.environ.get("GCC_PATH", "")
- if compiler_path:
- compiler_path = compiler_path + "/bin/"
- os.environ["PATH"] = ":".join([compiler_path, os.environ["PATH"]])
- compiler_options = [
- "-c++=%s" % os.path.basename(self.compiler.cxx),
- "-cc=%s" % os.path.basename(self.compiler.cc),
- ]
-
- if "+fortran" in spec and self.compiler.fc:
- compiler_options.append("-fortran=%s" % os.path.basename(self.compiler.fc))
+ compiler_flags: Dict[str, str] = {
+ flag: os.path.basename(getattr(self.compiler, compiler))
+ for flag, compiler in (("-cc", "cc"), ("-c++", "cxx"), ("-fortran", "fc"))
+ if getattr(self.compiler, compiler)
+ }
+
+ if "~fortran" in spec:
+ compiler_flags.pop("-fortran", None)
+
+ # tau does not understand `craycc`, `crayCC`, `crayftn`, strip off the `cray` prefix
+ for flag, value in compiler_flags.items():
+ if value.startswith("cray"):
+ compiler_flags[flag] = value[4:]
+
+ compiler_options = [f"{flag}={value}" for flag, value in compiler_flags.items()]
##########