Description of problem: Libraries within python2-libs, such as itertoolsmodule.so, do not link libpython2.7.so even though they use functions from this library. This makes it hard to use python in plugin modules, as the software using the plugin module has to link to python in order not to get errors like: ImportError: /usr/lib64/python2.7/lib-dynload/itertoolsmodule.so: undefined symbol: PyTuple_Type SUSE links to libpython2.7.so for the equivalent libraries in their python-base RPM. Version-Release number of selected component (if applicable): python2-libs-2.7.15-11.fc29.x86_64 How reproducible: Always nm -D /usr/lib64/python2.7/lib-dynload/itertoolsmodule.so |grep PyTuple_Type Steps to Reproduce: 1. ldd /usr/lib64/python2.7/lib-dynload/itertoolsmodule.so 2. nm -D /usr/lib64/python2.7/lib-dynload/itertoolsmodule.so |grep PyTuple_Type Actual results: 1: linux-vdso.so.1 (0x00007ffd3eaa4000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f62eb84d000) libc.so.6 => /lib64/libc.so.6 (0x00007f62eb687000) /lib64/ld-linux-x86-64.so.2 (0x00007f62eb8a6000) 2: U PyTuple_Type Expected results: Output from SuSE Enterprise 12.3(ldd itertools.so) where this is not a problem: 1: linux-vdso.so.1 (0x00007ffc0f54d000) libpython2.7.so.1.0 => /usr/lib64/libpython2.7.so.1.0 (0x00007fcfeb0bc000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fcfeae9f000) libc.so.6 => /lib64/libc.so.6 (0x00007fcfeaafa000) libdl.so.2 => /lib64/libdl.so.2 (0x00007fcfea8f6000) libutil.so.1 => /lib64/libutil.so.1 (0x00007fcfea6f3000) libm.so.6 => /lib64/libm.so.6 (0x00007fcfea3f6000) /lib64/ld-linux-x86-64.so.2 (0x00007fcfeb6d8000) 2: U PyTuple_Type Additional info:
BTW this seems not to be a problem in our Python 3 package (same with 3.7, 3.6, 3.5, 3.4): $ ldd /usr/lib64/python3.7/lib-dynload/array.cpython-37m-x86_64-linux-gnu.so linux-vdso.so.1 (0x00007ffe5870f000) libpython3.7m.so.1.0 => /lib64/libpython3.7m.so.1.0 (0x00007eff1d963000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007eff1d941000) libc.so.6 => /lib64/libc.so.6 (0x00007eff1d77b000) libdl.so.2 => /lib64/libdl.so.2 (0x00007eff1d775000) libutil.so.1 => /lib64/libutil.so.1 (0x00007eff1d770000) libm.so.6 => /lib64/libm.so.6 (0x00007eff1d5ec000) /lib64/ld-linux-x86-64.so.2 (0x00007eff1dd29000)
I started a discussion upstream but it's unclear if C extensions must always or never be linked to libpython: https://bugs.python.org/issue34814
tl;dr: Please link to libpython explicitly. Python extension modules are designed to be imported from Python, and you need libpython to do that. If you're loading the module differently, that use case isn't supported very well. If your plugin has functionality that'd be useful outside of Python, consider splitting it into a general-purpose library, and make the Python plugin a thin wrapper around that. Also, this is Python 2, which is deprecated, and is in Fedora mostly to support existing software (and for testing compatibility with Python 2). If this bug is not a regression, I don't think it is worth fixing.
Does that solve your issue? Can we close this bug?
I can live with working around until we start using Python 3, so you may close the issue.