Skip to content

Commit

Permalink
ENH: Don't add system library directories to rpath
Browse files Browse the repository at this point in the history
Last of the patches from pypa#73 
Might close pypa/setuptools#3257

Dual purposes here:
- On platforms like Cygwin that don't have `rpath`, try to avoid adding things to `rpath`
- Some distribution binary package makers require that no shared library list a system library directory (`/lib`, `/lib64`, `/usr/lib`, `/usr/lib64`) in its `rpath`; this patch simplifies the code to ensure the shared library can find its dependencies at runtime.
  • Loading branch information
DWesl committed Jun 28, 2024
1 parent f3b2254 commit d56a32d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions distutils/unixccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,15 @@ class UnixCCompiler(CCompiler):
dylib_lib_extension = ".dll"
dylib_lib_format = "cyg%s%s"

def _fix_lib_args(self, libraries, library_dirs, runtime_library_dirs):
"""Remove standard library path from rpath"""
libraries, library_dirs, runtime_library_dirs = super()._fix_lib_args(
libraries, library_dirs, runtime_library_dirs)
libdir = sysconfig.get_config_var('LIBDIR')
if runtime_library_dirs and (libdir in runtime_library_dirs):
runtime_library_dirs.remove(libdir)
return libraries, library_dirs, runtime_library_dirs

def preprocess(
self,
source,
Expand Down

0 comments on commit d56a32d

Please sign in to comment.