From 304f0e9ef1f0e811225d4cf5cce957d4431bb734 Mon Sep 17 00:00:00 2001 From: wspear Date: Tue, 17 Mar 2020 08:38:53 -0700 Subject: Corrected compiler filtering for TAU makefiles (#15342) * Implemented working file filtering to replace spack compiler wrapper with real compiler. * Using string=True instead of re.escape. Using self.prefix.lib instead of appending /lib. Co-authored-by: Wyatt Spear --- var/spack/repos/builtin/packages/tau/package.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/tau/package.py b/var/spack/repos/builtin/packages/tau/package.py index f17b8202d2..4ac71b793f 100644 --- a/var/spack/repos/builtin/packages/tau/package.py +++ b/var/spack/repos/builtin/packages/tau/package.py @@ -104,8 +104,6 @@ class Tau(Package): conflicts('+adios2', when='@:2.29.1') conflicts('+sqlite', when='@:2.29.1') - filter_compiler_wrappers('tau_cc.sh', 'Makefile.tau', relative_root='bin') - def set_compiler_options(self, spec): useropt = ["-O2 -g", self.rpath_args] @@ -271,11 +269,15 @@ class Tau(Package): compiler_specific_options = self.set_compiler_options(spec) options.extend(compiler_specific_options) configure(*options) + make("install") # Link arch-specific directories into prefix since there is # only one arch per prefix the way spack installs. self.link_tau_arch_dirs() + # TAU may capture Spack's internal compiler wrapper. Replace + # it with the correct compiler. + self.fix_tau_compilers() def link_tau_arch_dirs(self): for subdir in os.listdir(self.prefix): @@ -285,6 +287,22 @@ class Tau(Package): if os.path.isdir(src) and not os.path.exists(dest): os.symlink(join_path(subdir, d), dest) + def fix_tau_compilers(self): + filter_file('FULL_CC=' + spack_cc, 'FULL_CC=' + self.compiler.cc, + self.prefix + '/include/Makefile', backup=False, + string=True) + filter_file('FULL_CXX=' + spack_cxx, 'FULL_CXX=' + + self.compiler.cxx, self.prefix + '/include/Makefile', + backup=False, string=True) + for makefile in os.listdir(self.prefix.lib): + if makefile.startswith('Makefile.tau'): + filter_file('FULL_CC=' + spack_cc, 'FULL_CC=' + + self.compiler.cc, self.prefix.lib + "/" + + makefile, backup=False, string=True) + filter_file('FULL_CXX=' + spack_cxx, 'FULL_CXX=' + + self.compiler.cxx, self.prefix.lib + + "/" + makefile, backup=False, string=True) + def setup_run_environment(self, env): pattern = join_path(self.prefix.lib, 'Makefile.*') files = glob.glob(pattern) -- cgit v1.2.3-70-g09d2