summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/openmpi/package.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/openmpi/package.py b/var/spack/repos/builtin/packages/openmpi/package.py
index c82e58cfba..4251569072 100644
--- a/var/spack/repos/builtin/packages/openmpi/package.py
+++ b/var/spack/repos/builtin/packages/openmpi/package.py
@@ -575,6 +575,24 @@ class Openmpi(AutotoolsPackage, CudaPackage):
variant("openshmem", default=False, description="Enable building OpenSHMEM")
variant("debug", default=False, description="Make debug build", when="build_system=autotools")
+ variant(
+ "two_level_namespace",
+ default=False,
+ description="""Build shared libraries and programs
+built with the mpicc/mpifort/etc. compiler wrappers
+with '-Wl,-commons,use_dylibs' and without
+'-Wl,-flat_namespace'.""",
+ )
+
+ # Patch to allow two-level namespace on a MacOS platform when building
+ # openmpi. Unfortuntately, the openmpi configure command has flat namespace
+ # hardwired in. In spack, this only works for openmpi up to versions 4,
+ # because for versions 5+ autoreconf is triggered (see below) and this
+ # patch needs to be applied (again) AFTER autoreconf ran.
+ @when("+two_level_namespace platform=darwin")
+ def patch(self):
+ filter_file(r"-flat_namespace", "-commons,use_dylibs", "configure")
+
provides("mpi@:2.0", when="@:1.2")
provides("mpi@:2.1", when="@1.3:1.7.2")
provides("mpi@:2.2", when="@1.7.3:1.7.4")
@@ -997,11 +1015,15 @@ class Openmpi(AutotoolsPackage, CudaPackage):
def autoreconf(self, spec, prefix):
perl = which("perl")
perl("autogen.pl")
+ if spec.satisfies("+two_level_namespace platform=darwin"):
+ filter_file(r"-flat_namespace", "-commons,use_dylibs", "configure")
@when("@5.0.0:5.0.1")
def autoreconf(self, spec, prefix):
perl = which("perl")
perl("autogen.pl", "--force")
+ if spec.satisfies("+two_level_namespace platform=darwin"):
+ filter_file(r"-flat_namespace", "-commons,use_dylibs", "configure")
def configure_args(self):
spec = self.spec