[Python-checkins] [3.7] bpo-32647: Link ctypes extension with libdl. (GH-5550) (#5874)

Christian Heimes webhook-mailer at python.org
Sun Feb 25 07:07:27 EST 2018


https://github.com/python/cpython/commit/4cb373359d5ff29b222b10207516d294f3a54ad8
commit: 4cb373359d5ff29b222b10207516d294f3a54ad8
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Christian Heimes <christian at python.org>
date: 2018-02-25T13:07:24+01:00
summary:

[3.7] bpo-32647: Link ctypes extension with libdl. (GH-5550) (#5874)

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 at python.org>
(cherry picked from commit 5bb9692575f10f4a7c7f1c2c0c70956baf6d5c23)

Co-authored-by: Christian Heimes <christian at python.org>

files:
A Misc/NEWS.d/next/Library/2018-02-05-13-31-42.bpo-32647.ktmfR_.rst
M 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
index 000000000000..04fc0247bcde
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2018-02-05-13-31-42.bpo-32647.ktmfR_.rst
@@ -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.
diff --git a/setup.py b/setup.py
index f4f6e4fdb1f0..8536c350fe3a 100644
--- a/setup.py
+++ b/setup.py
@@ -2005,6 +2005,10 @@ def detect_ctypes(self, inc_dirs, lib_dirs):
             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 = []



More information about the Python-checkins mailing list