Skip to content

Commit c17f38f

Browse files
author
denfromufa
authored
Update setup.py
1 parent 64dba41 commit c17f38f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

setup.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,15 @@ def build_extension(self, ext):
151151
else:
152152
defines.append("MONO_LINUX")
153153

154-
# Disable this check due to issues on Ubuntu
155154
# Check if --enable-shared was set when Python was built
156-
# enable_shared = get_config_var("Py_ENABLE_SHARED")
157-
# if enable_shared == 0:
158-
defines.append("PYTHON_WITHOUT_ENABLE_SHARED")
155+
enable_shared = get_config_var("Py_ENABLE_SHARED")
156+
if enable_shared == 1:
157+
# Double-check if libpython is linked dynamically with python
158+
lddout = check_output(["ldd", sys.executable])
159+
if 'libpython' not in lddout:
160+
enable_shared = 0
161+
if enable_shared == 0:
162+
defines.append("PYTHON_WITHOUT_ENABLE_SHARED")
159163

160164
if hasattr(sys, "abiflags"):
161165
if "d" in sys.abiflags:

0 commit comments

Comments
 (0)