From f51de5bbacb7e155d0a07f247f5e28718852f6f3 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Sun, 25 Feb 2018 10:22:14 +0100 Subject: [PATCH] [2.7] bpo-32647: Link ctypes extension with libdl. (GH-5550) 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 . (cherry picked from commit 5bb9692575f10f4a7c7f1c2c0c70956baf6d5c23) Co-authored-by: Christian Heimes --- .../next/Library/2018-02-05-13-31-42.bpo-32647.ktmfR_.rst | 2 ++ setup.py | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2018-02-05-13-31-42.bpo-32647.ktmfR_.rst 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 00000000000000..04fc0247bcdefc --- /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 c1366c8436ad20..33cecc6875739c 100644 --- a/setup.py +++ b/setup.py @@ -2149,6 +2149,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 _detect_nis(self, inc_dirs, lib_dirs): if host_platform in {'win32', 'cygwin', 'qnx6'}: return None