]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45371: Fix distutils' rpath support for clang (GH-28732)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 5 Oct 2021 10:09:21 +0000 (03:09 -0700)
committerGitHub <noreply@github.com>
Tue, 5 Oct 2021 10:09:21 +0000 (03:09 -0700)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit ef6196028f966f22d82930b66e1371e75c5df2f7)

Co-authored-by: Christian Heimes <christian@python.org>
Lib/distutils/unixccompiler.py
Misc/NEWS.d/next/Library/2021-10-05-11-03-48.bpo-45371.NOwcDJ.rst [new file with mode: 0644]

index f0792de74a1a489a8232d89b6302c77d91a7552e..d00c48981eb6d65cb89b316822630d4cb76af54d 100644 (file)
@@ -215,7 +215,8 @@ class UnixCCompiler(CCompiler):
         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 (file)
index 0000000..045489b
--- /dev/null
@@ -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.