Skip to content

Commit

Permalink
distutils: do pass -rpath on macOS >=10.5
Browse files Browse the repository at this point in the history
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:
python/cpython#12418

Signed-off-by: Alexei Colin <acolin@isi.edu>
  • Loading branch information
tovrstra authored and acolinisi committed Apr 25, 2021
1 parent 7423f07 commit 9d037b5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions distutils/unixccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,11 @@ 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
_osx_ver = sysconfig.get_config_var("MACOSX_DEPLOYMENT_TARGET")
if _osx_ver and [int(c) for c in _osx_ver.split('.')] >= [10, 5]:
return "-Wl,-rpath," + dir
else: # no support for -rpath prior to OS X 10.5
return "-L" + dir
elif sys.platform[:7] == "freebsd":
return "-Wl,-rpath=" + dir
elif sys.platform[:5] == "hp-ux":
Expand Down

0 comments on commit 9d037b5

Please sign in to comment.