diff --git a/var/spack/repos/builtin/packages/openmpi/package.py b/var/spack/repos/builtin/packages/openmpi/package.py index 2cd70dbc07..7c79e8732d 100644 --- a/var/spack/repos/builtin/packages/openmpi/package.py +++ b/var/spack/repos/builtin/packages/openmpi/package.py @@ -367,6 +367,14 @@ def setup_dependent_build_environment(self, env, dependent_spec): env.set('OMPI_FC', spack_fc) env.set('OMPI_F77', spack_f77) + # See https://www.open-mpi.org/faq/?category=building#installdirs + for suffix in ['PREFIX', 'EXEC_PREFIX', 'BINDIR', 'SBINDIR', + 'LIBEXECDIR', 'DATAROOTDIR', 'DATADIR', 'SYSCONFDIR', + 'SHAREDSTATEDIR', 'LOCALSTATEDIR', 'LIBDIR', + 'INCLUDEDIR', 'INFODIR', 'MANDIR', 'PKGDATADIR', + 'PKGLIBDIR', 'PKGINCLUDEDIR']: + env.unset('OPAL_%s' % suffix) + def setup_dependent_package(self, module, dependent_spec): self.spec.mpicc = join_path(self.prefix.bin, 'mpicc') self.spec.mpicxx = join_path(self.prefix.bin, 'mpic++')