diff options
author | Abhik Sarkar <62109745+asarkar-parsys@users.noreply.github.com> | 2022-12-09 18:30:45 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-09 18:30:45 -0800 |
commit | f9d9d43b632e0c1c39bf8f57a05d7b3004fc461d (patch) | |
tree | d08443c496ec7033c78659557d77bdf8445be75c /var | |
parent | db8f115013d3a6991da3f92aeee3e49327a24833 (diff) | |
download | spack-f9d9d43b632e0c1c39bf8f57a05d7b3004fc461d.tar.gz spack-f9d9d43b632e0c1c39bf8f57a05d7b3004fc461d.tar.bz2 spack-f9d9d43b632e0c1c39bf8f57a05d7b3004fc461d.tar.xz spack-f9d9d43b632e0c1c39bf8f57a05d7b3004fc461d.zip |
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
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/hwloc/package.py | 5 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/libevent/package.py | 5 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/pmix/package.py | 26 |
3 files changed, 36 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/hwloc/package.py b/var/spack/repos/builtin/packages/hwloc/package.py index 4c67d3e32b..706328f7c5 100644 --- a/var/spack/repos/builtin/packages/hwloc/package.py +++ b/var/spack/repos/builtin/packages/hwloc/package.py @@ -146,6 +146,11 @@ class Hwloc(AutotoolsPackage, CudaPackage, ROCmPackage): url = "https://download.open-mpi.org/release/hwloc/v{0}/hwloc-{1}.tar.gz" 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): args = [] diff --git a/var/spack/repos/builtin/packages/libevent/package.py b/var/spack/repos/builtin/packages/libevent/package.py index 9042a566d4..2a49064d95 100644 --- a/var/spack/repos/builtin/packages/libevent/package.py +++ b/var/spack/repos/builtin/packages/libevent/package.py @@ -49,6 +49,11 @@ class Libevent(AutotoolsPackage): 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): spec = self.spec configure_args = [] diff --git a/var/spack/repos/builtin/packages/pmix/package.py b/var/spack/repos/builtin/packages/pmix/package.py index 999535b92f..39433e3f30 100644 --- a/var/spack/repos/builtin/packages/pmix/package.py +++ b/var/spack/repos/builtin/packages/pmix/package.py @@ -3,6 +3,7 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os +import platform from spack.package import * @@ -97,6 +98,18 @@ class Pmix(AutotoolsPackage): perl = which("perl") 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): spec = self.spec @@ -105,6 +118,19 @@ class Pmix(AutotoolsPackage): config_args.append("--with-libevent=" + spec["libevent"].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( |