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 authored Jul 31, 2022
1 parent 9ae4f9b commit 20fd663
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 @@ -139,6 +139,15 @@ class UnixCCompiler(CCompiler):
if sys.platform == "cygwin":
exe_extension = ".exe"

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 20fd663

Please sign in to comment.