From 5e5fab060c3b52e2929576c03520761a97c670f9 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Fri, 25 Aug 2023 21:36:58 +0200 Subject: [PATCH] setup.py: don't prepend the system library directories when building extensions For some reason the code assumes that relative paths are build paths prepends the system dirs after relative paths in the existing list. We only uses absolute paths though, and I don't understand why it even tries to do that. So just append the system dirs instead. This fixes the build trying to link against the system Python DLL in case it happens to be installed. --- setup.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index e4f15d80b861b3..946ee91a41b74b 100644 --- a/setup.py +++ b/setup.py @@ -889,10 +889,8 @@ def init_inc_lib_dirs(self): # (PYTHONFRAMEWORK is set) to avoid # linking problems when # building a framework with different architectures than # the one that is currently installed (issue #7473) - add_dir_to_list(self.compiler.library_dirs, - sysconfig.get_config_var("LIBDIR")) - add_dir_to_list(self.compiler.include_dirs, - sysconfig.get_config_var("INCLUDEDIR")) + self.compiler.library_dirs.append(sysconfig.get_config_var("LIBDIR")) + self.compiler.include_dirs.append(sysconfig.get_config_var("INCLUDEDIR")) system_lib_dirs = ['/lib64', '/usr/lib64', '/lib', '/usr/lib'] system_include_dirs = ['/usr/include']