faiss: fixed error when importing faiss python package (#34672)

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 <pottier1@llnl.gov>
Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
This commit is contained in:
Loïc Pottier 2023-01-17 04:43:35 -08:00 committed by GitHub
parent 5074e72be8
commit ff4cccbf6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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):