Skip to content

Commit d56a32d

Browse files
committed
ENH: Don't add system library directories to rpath
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.
1 parent f3b2254 commit d56a32d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

distutils/unixccompiler.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,15 @@ class UnixCCompiler(CCompiler):
148148
dylib_lib_extension = ".dll"
149149
dylib_lib_format = "cyg%s%s"
150150

151+
def _fix_lib_args(self, libraries, library_dirs, runtime_library_dirs):
152+
"""Remove standard library path from rpath"""
153+
libraries, library_dirs, runtime_library_dirs = super()._fix_lib_args(
154+
libraries, library_dirs, runtime_library_dirs)
155+
libdir = sysconfig.get_config_var('LIBDIR')
156+
if runtime_library_dirs and (libdir in runtime_library_dirs):
157+
runtime_library_dirs.remove(libdir)
158+
return libraries, library_dirs, runtime_library_dirs
159+
151160
def preprocess(
152161
self,
153162
source,

0 commit comments

Comments
 (0)