From c0d1fbbf665694c5d201eebb2a75a143ede8e50a Mon Sep 17 00:00:00 2001 From: Kumi Date: Fri, 9 Feb 2024 15:33:51 +0100 Subject: [PATCH] Enhance extension building in setup Updated the `BuildExtCommand` class in `setup.py` to append `rpath` flags and link against `hdf5` libraries when building extensions. This ensures that the shared libraries are correctly located at runtime and resolves potential linkage issues with HDF5-related extensions for a smoother installation and deployment process. --- setup.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/setup.py b/setup.py index 1510f56..b5fd057 100644 --- a/setup.py +++ b/setup.py @@ -12,6 +12,13 @@ class BuildExtCommand(build_ext): """Custom build_ext command to ensure that the submodule is retrieved and built.""" def build_extensions(self): + rpath_flags = ['-Wl,-rpath,/usr/lib/'] + for ext in self.extensions: + ext.extra_compile_args = rpath_flags + ext.extra_link_args = rpath_flags + ext.libraries.extend(['hdf5', 'hdf5_cpp']) + build_ext.build_extensions(self) + super().build_extensions() def run(self):