Support for building Pmix with Debian/Ubuntu external dependencies (#32690)

* Debian like distros use multiarch implementation spec
https://wiki.ubuntu.com/MultiarchSpec
Instead of being limited to /usr/lib64, architecture based
lib directories are used. For instance, under ubuntu a library package
on x86_64 installs binaries under /usr/lib/x86_64-linux-gnu.
Building pmix with external dependencies like hwloc or libevent
fail as with prefix set to /usr, that prefix works for
headers and binaries but does not work for libraries. The default
location for library /usr/lib64 does not hold installed binaries.
Pmix build options --with-libevent and --with-libhwloc allow us to
specify dependent library locations. This commit is an effort to
highlight and resolve such an issue when a users want to use Debian like
distro library packages and use spack to build pmix.
There maybe other packages that might be impacted in a similar way.

* Adding libs property to hwloc and libevent and some cleanups to pmix patch

* Fixing style and adding comment on Pmix' 32-bit hwloc version detection issue
This commit is contained in:
Abhik Sarkar 2022-12-09 18:30:45 -08:00 committed by GitHub
parent db8f115013
commit f9d9d43b63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 0 deletions

View file

@ -146,6 +146,11 @@ def url_for_version(self, version):
url = "https://download.open-mpi.org/release/hwloc/v{0}/hwloc-{1}.tar.gz" url = "https://download.open-mpi.org/release/hwloc/v{0}/hwloc-{1}.tar.gz"
return url.format(version.up_to(2), version) return url.format(version.up_to(2), version)
@property
def libs(self):
libs = find_libraries("libhwloc", root=self.prefix, shared=True, recursive=True)
return LibraryList(libs)
def configure_args(self): def configure_args(self):
args = [] args = []

View file

@ -49,6 +49,11 @@ def url_for_version(self, version):
return url.format(version) return url.format(version)
@property
def libs(self):
libs = find_libraries("libevent", root=self.prefix, shared=True, recursive=True)
return LibraryList(libs)
def configure_args(self): def configure_args(self):
spec = self.spec spec = self.spec
configure_args = [] configure_args = []

View file

@ -3,6 +3,7 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os import os
import platform
from spack.package import * from spack.package import *
@ -97,6 +98,18 @@ def autoreconf(self, spec, prefix):
perl = which("perl") perl = which("perl")
perl("./autogen.pl") perl("./autogen.pl")
def find_external_lib_path(self, pkg_name, path_match_str=""):
spec = self.spec
tgt_libpath = ""
dir_list = spec[pkg_name].libs
for entry in dir_list:
if path_match_str == "" or (path_match_str != "" and path_match_str in entry):
tgt_libpath = entry
break
path_list = tgt_libpath.split(os.sep)
del path_list[-1]
return (os.sep).join(path_list)
def configure_args(self): def configure_args(self):
spec = self.spec spec = self.spec
@ -105,6 +118,19 @@ def configure_args(self):
config_args.append("--with-libevent=" + spec["libevent"].prefix) config_args.append("--with-libevent=" + spec["libevent"].prefix)
config_args.append("--with-hwloc=" + spec["hwloc"].prefix) config_args.append("--with-hwloc=" + spec["hwloc"].prefix)
# As of 09/22/22 pmix build does not detect the hwloc version
# for 32-bit architecture correctly. Since, we have only been
# able to test on 64-bit architecture, we are keeping this
# check for "64" in place. We will need to re-visit this when we
# have the fix in Pmix for 32-bit library version detection
if "64" in platform.machine():
if spec["libevent"].external_path:
dep_libpath = self.find_external_lib_path("libevent", "64")
config_args.append("--with-libevent-libdir=" + dep_libpath)
if spec["hwloc"].external_path:
dep_libpath = self.find_external_lib_path("hwloc", "64")
config_args.append("--with-hwloc-libdir=" + dep_libpath)
config_args.extend(self.enable_or_disable("python-bindings", variant="python")) config_args.extend(self.enable_or_disable("python-bindings", variant="python"))
config_args.extend( config_args.extend(