mpich, openmpi: fix setting up dependent build environment

This commit is contained in:
Massimiliano Culpo 2024-12-23 14:20:25 +01:00
parent 787f7d7729
commit 1da005f6bd
No known key found for this signature in database
GPG Key ID: 3E52BB992233066C

View File

@ -899,10 +899,16 @@ def setup_run_environment(self, env):
def setup_dependent_build_environment(self, env, dependent_spec):
# Use the spack compiler wrappers under MPI
dependent_module = dependent_spec.package.module
env.set("OMPI_CC", dependent_module.spack_cc)
env.set("OMPI_CXX", dependent_module.spack_cxx)
env.set("OMPI_FC", dependent_module.spack_fc)
env.set("OMPI_F77", dependent_module.spack_f77)
for var_name, attr_name in (
("OMPI_CC", "spack_cc"),
("OMPI_CXX", "spack_cxx"),
("OMPI_FC", "spack_fc"),
("OMPI_F77", "spack_f77"),
):
if not hasattr(dependent_module, attr_name):
continue
env.set(var_name, getattr(dependent_module, attr_name))
# See https://www.open-mpi.org/faq/?category=building#installdirs
for suffix in [