From 694904e62b64d959cab09a435db344d3dff26008 Mon Sep 17 00:00:00 2001 From: Toon Verstraelen Date: Mon, 18 Mar 2019 13:35:20 -0400 Subject: [PATCH] distutils: pass -rpath on macOS when requested Fix -R option of build_ext for macOS (darwin) Resolves this old bug against distutils that expired due to PIP 632: https://bugs.python.org/issue36353 Applies patch originally submitted to CPython: https://github.com/python/cpython/pull/12418 --- distutils/unixccompiler.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/distutils/unixccompiler.py b/distutils/unixccompiler.py index 4d7a6de7..7fe2eeef 100644 --- a/distutils/unixccompiler.py +++ b/distutils/unixccompiler.py @@ -233,8 +233,7 @@ def runtime_library_dir_option(self, dir): # we use this hack. compiler = os.path.basename(sysconfig.get_config_var("CC")) if sys.platform[:6] == "darwin": - # MacOSX's linker doesn't understand the -R flag at all - return "-L" + dir + return "-Wl,-rpath," + dir elif sys.platform[:7] == "freebsd": return "-Wl,-rpath=" + dir elif sys.platform[:5] == "hp-ux":