]> granicus.if.org Git - python/commitdiff
[3.6] bpo-32647: Link ctypes extension with libdl. (GH-5550) (#5875)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 25 Feb 2018 12:07:36 +0000 (04:07 -0800)
committerChristian Heimes <christian@python.org>
Sun, 25 Feb 2018 12:07:36 +0000 (13:07 +0100)
The ctypes module used to depend on indirect linking for dlopen. The shared
extension is now explicitly linked against libdl on platforms with dl.

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 5bb9692575f10f4a7c7f1c2c0c70956baf6d5c23)

Co-authored-by: Christian Heimes <christian@python.org>
Misc/NEWS.d/next/Library/2018-02-05-13-31-42.bpo-32647.ktmfR_.rst [new file with mode: 0644]
setup.py

diff --git a/Misc/NEWS.d/next/Library/2018-02-05-13-31-42.bpo-32647.ktmfR_.rst b/Misc/NEWS.d/next/Library/2018-02-05-13-31-42.bpo-32647.ktmfR_.rst
new file mode 100644 (file)
index 0000000..04fc024
--- /dev/null
@@ -0,0 +1,2 @@
+The ctypes module used to depend on indirect linking for dlopen. The shared
+extension is now explicitly linked against libdl on platforms with dl.
index 1ec58aa37924eb75a821cfeb647a741ab614f2ea..49193f67a6117a9a1ac8feffe0e40e126a330635 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -2089,6 +2089,10 @@ class PyBuildExt(build_ext):
             ext.libraries.append(ffi_lib)
             self.use_system_libffi = True
 
+        if sysconfig.get_config_var('HAVE_LIBDL'):
+            # for dlopen, see bpo-32647
+            ext.libraries.append('dl')
+
     def _decimal_ext(self):
         extra_compile_args = []
         undef_macros = []