[Python-checkins] [3.10] bpo-45371: Fix distutils' rpath support for clang (GH-28732) (GH-28733)
miss-islington
webhook-mailer at python.org
Tue Oct 5 06:04:56 EDT 2021
https://github.com/python/cpython/commit/3733dddecaa332966e200718d4993545f8e52247
commit: 3733dddecaa332966e200718d4993545f8e52247
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2021-10-05T03:04:52-07:00
summary:
[3.10] bpo-45371: Fix distutils' rpath support for clang (GH-28732) (GH-28733)
Signed-off-by: Christian Heimes <christian at python.org>
(cherry picked from commit ef6196028f966f22d82930b66e1371e75c5df2f7)
Co-authored-by: Christian Heimes <christian at python.org>
Automerge-Triggered-By: GH:tiran
files:
A Misc/NEWS.d/next/Library/2021-10-05-11-03-48.bpo-45371.NOwcDJ.rst
M Lib/distutils/unixccompiler.py
diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py
index f0792de74a1a4..d00c48981eb6d 100644
--- a/Lib/distutils/unixccompiler.py
+++ b/Lib/distutils/unixccompiler.py
@@ -215,7 +215,8 @@ def library_dir_option(self, dir):
return "-L" + dir
def _is_gcc(self, compiler_name):
- return "gcc" in compiler_name or "g++" in compiler_name
+ # clang uses same syntax for rpath as gcc
+ return any(name in compiler_name for name in ("gcc", "g++", "clang"))
def runtime_library_dir_option(self, dir):
# XXX Hackish, at the very least. See Python bug #445902:
diff --git a/Misc/NEWS.d/next/Library/2021-10-05-11-03-48.bpo-45371.NOwcDJ.rst b/Misc/NEWS.d/next/Library/2021-10-05-11-03-48.bpo-45371.NOwcDJ.rst
new file mode 100644
index 0000000000000..045489be81a19
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2021-10-05-11-03-48.bpo-45371.NOwcDJ.rst
@@ -0,0 +1,3 @@
+Fix clang rpath issue in :mod:`distutils`. The UnixCCompiler now uses
+correct clang option to add a runtime library directory (rpath) to a shared
+library.
More information about the Python-checkins
mailing list