From 99262a2b97365666a83a3697cb499f4a0fd0bf7e Mon Sep 17 00:00:00 2001 From: Giorgos Tzampanakis Date: Wed, 22 Sep 2021 15:56:46 +0300 Subject: [PATCH] Add pg_config libdir to the library's rpath Close #1356. --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8137ef630..12be88e22 100644 --- a/setup.py +++ b/setup.py @@ -74,6 +74,7 @@ version_flags = ['dt', 'dec'] PLATFORM_IS_WINDOWS = sys.platform.lower().startswith('win') +PLATFORM_IS_LINUX = sys.platform.lower().startswith('linux') class PostgresConfig: @@ -372,7 +373,10 @@ def finalize_options(self): self.libraries.append("pq") try: - self.library_dirs.append(pg_config_helper.query("libdir")) + pg_config_libdir = pg_config_helper.query("libdir") + self.library_dirs.append(pg_config_libdir) + if PLATFORM_IS_LINUX: + self.rpath.append(pg_config_libdir) self.include_dirs.append(pg_config_helper.query("includedir")) self.include_dirs.append(pg_config_helper.query("includedir-server"))