Bug 1667914 - Libraries in python2-libs do not link libpython2.7.so
Summary: Libraries in python2-libs do not link libpython2.7.so
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: python2
Version: 29
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Charalampos Stratakis
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-01-21 12:15 UTC by Kjell Irgens
Modified: 2019-02-05 13:23 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2019-02-05 13:23:06 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Python 34814 0 None None None 2019-01-21 13:08:09 UTC

Description Kjell Irgens 2019-01-21 12:15:24 UTC
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:

Comment 1 Miro Hrončok 2019-01-21 12:24:32 UTC
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)

Comment 2 Victor Stinner 2019-01-21 13:08:09 UTC
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

Comment 3 Petr Viktorin (pviktori) 2019-01-21 13:25:56 UTC
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.

Comment 4 Petr Viktorin (pviktori) 2019-02-04 13:26:50 UTC
Does that solve your issue? Can we close this bug?

Comment 5 Kjell Irgens 2019-02-05 13:12:35 UTC
I can live with working around until we start using Python 3, so you may close the issue.


Note You need to log in before you can comment on or make changes to this bug.