From ff4cccbf6c89e28b20fd3e47475982d7dc701c4f Mon Sep 17 00:00:00 2001 From: Loïc Pottier <48072795+lpottier@users.noreply.github.com> Date: Tue, 17 Jan 2023 04:43:35 -0800 Subject: faiss: fixed error when importing faiss python package (#34672) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is only a work-around for the actual problem that Python is used to install libraries instead of CMake, so we end up with BUILD_RPATH not INSTALL_RPATHs. Signed-off-by: Loïc Pottier Co-authored-by: Harmen Stoppels --- var/spack/repos/builtin/packages/faiss/package.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/faiss/package.py b/var/spack/repos/builtin/packages/faiss/package.py index f26a1023dd..c16f490c0f 100644 --- a/var/spack/repos/builtin/packages/faiss/package.py +++ b/var/spack/repos/builtin/packages/faiss/package.py @@ -22,7 +22,7 @@ class Faiss(AutotoolsPackage, CMakePackage, CudaPackage): homepage = "https://github.com/facebookresearch/faiss" url = "https://github.com/facebookresearch/faiss/archive/v1.6.3.tar.gz" - maintainers = ["bhatiaharsh", "rblake-llnl"] + maintainers = ["bhatiaharsh", "rblake-llnl", "lpottier"] build_system( conditional("cmake", when="@1.7:"), conditional("autotools", when="@:1.6"), default="cmake" @@ -75,6 +75,12 @@ class Faiss(AutotoolsPackage, CMakePackage, CudaPackage): def setup_run_environment(self, env): if "+python" in self.spec: env.prepend_path("PYTHONPATH", python_platlib) + if self.spec.satisfies("platform=darwin"): + env.append_path( + "DYLD_FALLBACK_LIBRARY_PATH", os.path.join(python_platlib, "faiss") + ) + else: + env.append_path("LD_LIBRARY_PATH", os.path.join(python_platlib, "faiss")) class CMakeBuilder(spack.build_systems.cmake.CMakeBuilder): -- cgit v1.2.3-60-g2f50