diff --git a/lib/spack/spack/mixins.py b/lib/spack/spack/mixins.py index 82e6f8bdad..0a43e76961 100644 --- a/lib/spack/spack/mixins.py +++ b/lib/spack/spack/mixins.py @@ -143,24 +143,47 @@ def filter_compiler_wrappers(*files, **kwargs): whatever compiler they were built with. Args: - *files: files to be filtered - **kwargs: at present supports the keyword 'after' to specify after - which phase the files should be filtered (defaults to 'install'). + *files: files to be filtered relative to the search root (which is, + by default, the installation prefix) + + **kwargs: allowed keyword arguments + + after + specifies after which phase the files should be + filtered (defaults to 'install') + + relative_root + path relative to prefix where to start searching for + the files to be filtered. If not set the install prefix + wil be used as the search root. **It is highly recommended + to set this, as searching from the installation prefix may + affect performance severely in some cases**. + + ignore_absent, backup + these two keyword arguments, if present, will be forwarded + to ``filter_file`` (see its documentation for more information + on their behavior) """ after = kwargs.get('after', 'install') + relative_root = kwargs.get('relative_root', None) + + filter_kwargs = { + 'ignore_absent': kwargs.get('ignore_absent', True), + 'backup': kwargs.get('backup', False), + 'string': True + } def _filter_compiler_wrappers_impl(self): + # Compute the absolute path of the search root + root = os.path.join( + self.prefix, relative_root + ) if relative_root else self.prefix + # Compute the absolute path of the files to be filtered and # remove links from the list. - abs_files = llnl.util.filesystem.find(self.prefix, files) + abs_files = llnl.util.filesystem.find(root, files) abs_files = [x for x in abs_files if not os.path.islink(x)] - filter_kwargs = { - 'ignore_absent': True, - 'backup': False, - 'string': True - } - x = llnl.util.filesystem.FileFilter(*abs_files) x.filter(os.environ['CC'], self.compiler.cc, **filter_kwargs) diff --git a/var/spack/repos/builtin/packages/hdf5/package.py b/var/spack/repos/builtin/packages/hdf5/package.py index 3c729412ab..0ead42d41b 100644 --- a/var/spack/repos/builtin/packages/hdf5/package.py +++ b/var/spack/repos/builtin/packages/hdf5/package.py @@ -97,7 +97,7 @@ class Hdf5(AutotoolsPackage): patch('h5f90global-mult-obj-same-equivalence-same-common-block.patch', when='@1.10.1%intel@18') - filter_compiler_wrappers('h5cc', 'h5c++', 'h5fc') + filter_compiler_wrappers('h5cc', 'h5c++', 'h5fc', relative_root='bin') def url_for_version(self, version): url = "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-{0}/hdf5-{1}/src/hdf5-{1}.tar.gz" diff --git a/var/spack/repos/builtin/packages/mpich/package.py b/var/spack/repos/builtin/packages/mpich/package.py index 69dd75e3e1..5573b71197 100644 --- a/var/spack/repos/builtin/packages/mpich/package.py +++ b/var/spack/repos/builtin/packages/mpich/package.py @@ -71,7 +71,9 @@ class Mpich(AutotoolsPackage): provides('mpi@:3.0', when='@3:') provides('mpi@:1.3', when='@1:') - filter_compiler_wrappers('mpicc', 'mpicxx', 'mpif77', 'mpif90') + filter_compiler_wrappers( + 'mpicc', 'mpicxx', 'mpif77', 'mpif90', 'mpifort', relative_root='bin' + ) # fix MPI_Barrier segmentation fault # see https://lists.mpich.org/pipermail/discuss/2016-May/004764.html diff --git a/var/spack/repos/builtin/packages/mvapich2/package.py b/var/spack/repos/builtin/packages/mvapich2/package.py index 256418da9c..8dab2e9d6d 100644 --- a/var/spack/repos/builtin/packages/mvapich2/package.py +++ b/var/spack/repos/builtin/packages/mvapich2/package.py @@ -107,7 +107,9 @@ class Mvapich2(AutotoolsPackage): depends_on('libpciaccess', when=(sys.platform != 'darwin')) depends_on('cuda', when='+cuda') - filter_compiler_wrappers('mpicc', 'mpicxx', 'mpif77', 'mpif90', 'mpifort') + filter_compiler_wrappers( + 'mpicc', 'mpicxx', 'mpif77', 'mpif90', 'mpifort', relative_root='bin' + ) def url_for_version(self, version): base_url = "http://mvapich.cse.ohio-state.edu/download" diff --git a/var/spack/repos/builtin/packages/openmpi/package.py b/var/spack/repos/builtin/packages/openmpi/package.py index 343b69ea7e..889455aae0 100644 --- a/var/spack/repos/builtin/packages/openmpi/package.py +++ b/var/spack/repos/builtin/packages/openmpi/package.py @@ -228,7 +228,8 @@ class Openmpi(AutotoolsPackage): 'mpif90-vt-wrapper-data.txt', 'mpif90-wrapper-data.txt', 'mpif77-vt-wrapper-data.txt', - 'mpif77-wrapper-data.txt' + 'mpif77-wrapper-data.txt', + relative_root=os.path.join('share', 'openmpi') ) def url_for_version(self, version): diff --git a/var/spack/repos/builtin/packages/r/package.py b/var/spack/repos/builtin/packages/r/package.py index cb955579a3..4b5dd05c33 100644 --- a/var/spack/repos/builtin/packages/r/package.py +++ b/var/spack/repos/builtin/packages/r/package.py @@ -88,7 +88,9 @@ class R(AutotoolsPackage): patch('zlib.patch', when='@:3.3.2') - filter_compiler_wrappers('Makeconf') + filter_compiler_wrappers( + 'Makeconf', relative_root=os.path.join('rlib', 'R', 'etc') + ) @property def etcdir(self):