Bug 1302120

Summary: boost-python has no linkage-to or dependency on libpython
Product: Red Hat Enterprise Linux 7 Reporter: Yaakov Selkowitz <yselkowi>
Component: boostAssignee: Jonathan Wakely <jwakely>
Status: CLOSED ERRATA QA Contact: Miloš Prchlík <mprchlik>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: fale, mcermak, mnewsome, mprchlik
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: The Boost.Python dynamic libraries are not linked with a dependency on libpython2.7.so for reasons which are not applicable to Red Hat Enterprise Linux. Consequence: Programs which use Boost.Python must link to libpython2.7.so explicitly. Fix: The Boost.Python libraries are built with a dependency on the dynamic library from the system Python. Result: Boost.Python dynamic libraries now have a dependency on the libpython2.7so dynamic library. It is no longer necessary to link to that dynamic library explicitly unless functions from it are used explicitly.
Story Points: ---
Clone Of: 1102667 Environment:
Last Closed: 2016-11-04 06:32:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1102667, 1318383    
Bug Blocks:    

Description Yaakov Selkowitz 2016-01-26 20:30:34 UTC
The original bug, cloned below, was fixed since F20 with the following commit:

http://pkgs.fedoraproject.org/cgit/rpms/boost.git/commit/?id=1d8ca55777d7a62c0fb67906bf3e0e56ed1aad5e

However, this has not been fixed in RHEL, as discovered when epel7 rb_libtorrent-1.0.8-1.el7 FTBFS where the very same version built successfully on Fedora:

http://koji.fedoraproject.org/koji/packageinfo?packageID=3718

Where the following configure test failed on EPEL7:

configure:19480: checking for main in -lboost_python
configure:19499: gcc -o conftest -lpthread -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -I/usr/include  -L/usr/lib64 -Wl,-z,relro  conftest.c -lboost_python  -lpthread   >&5
/usr/lib64/libboost_python.so: undefined reference to `PyList_Insert'
/usr/lib64/libboost_python.so: undefined reference to `PyExc_ImportError'
/usr/lib64/libboost_python.so: undefined reference to `PyString_InternFromString'
[and so on for another 140 lines]

+++ This bug was initially created as a clone of Bug #1102667 +++

It seems that boost-python has no linkage-to or dependency on libpython.  I discovered this investigating possibly related bug #1101626

The last boost-python that links against libpython appears to be boost-python-1.48.0 (I inspected http://koji.fedoraproject.org/koji/rpminfo?rpmID=3167510 )

$ rpm -q boost-python
boost-python-1.54.0-9.fc20.x86_64

$ rpm -qR boost-python | grep py
(empty)

$ ldd -r /usr/lib64/libboost_python.so.1.54.0 
        linux-vdso.so.1 =>  (0x00007fff06d59000)
        libutil.so.1 => /lib64/libutil.so.1 (0x00007f5102adc000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f51028bf000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f51026ba000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f51024b2000)
        libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f51021aa000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f5101ea2000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f5101c8c000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f51018cd000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f5102f7b000)
undefined symbol: PyExc_ImportError     (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyProperty_Type       (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyExc_StopIteration   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyBool_Type   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyClass_Type  (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyExc_ValueError      (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyList_Type   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: _Py_NotImplementedStruct      (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyExc_TypeError       (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyDict_Type   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyInt_Type    (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyComplex_Type        (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyExc_ReferenceError  (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyModule_Type (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyBaseObject_Type     (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyFloat_Type  (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyExc_IndexError      (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyUnicode_Type        (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyTuple_Type  (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyExc_RuntimeError    (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyType_Type   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyMethod_Type (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyStaticMethod_Type   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyLong_Type   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: _Py_NoneStruct        (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyExc_OverflowError   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyExc_AttributeError  (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyCFunction_Type      (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyString_Type (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyType_GenericAlloc   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyList_Insert (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyString_InternFromString     (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyString_AsString     (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyUnicodeUCS4_FromEncodedObject       (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyImport_Import       (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_InPlaceRshift        (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyObject_CallMethod   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyIter_Next   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_Remainder    (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: Py_InitModule4_64     (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyType_Ready  (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: _PyEval_SliceIndex    (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyFile_AsFile (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyLong_FromUnsignedLong       (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyMem_Free    (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_InPlaceXor   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_InPlaceOr    (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyBool_FromLong       (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyDict_Items  (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_InPlaceRemainder     (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyErr_NoMemory        (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyComplex_ImagAsDouble        (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyObject_IsTrue       (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_Lshift       (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_InPlaceMultiply      (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: _PyObject_New (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyObject_GetItem      (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyString_FromStringAndSize    (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_InPlaceLshift        (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyString_Size (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyDict_Update (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyComplex_RealAsDouble        (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyErr_Format  (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_And  (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyUnicodeUCS4_AsWideChar      (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_InPlaceAdd   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyObject_GetAttr      (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyErr_ExceptionMatches        (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyErr_Occurred        (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyDict_Copy   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyArg_ParseTupleAndKeywords   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_Divide       (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyEval_GetGlobals     (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyDict_Keys   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyErr_SetObject       (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_Multiply     (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyRun_FileExFlags     (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyObject_Size (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyString_FromString   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyString_FromFormat   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_InPlaceAnd   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyInt_FromLong        (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyDict_Size   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyDict_GetItem        (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyObject_SetItem      (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyInt_AsLong  (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyObject_RichCompare  (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyCFunction_NewEx     (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyDict_Values (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_Rshift       (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyStaticMethod_New    (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyType_IsSubtype      (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_Add  (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyList_Sort   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PySequence_DelSlice   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyErr_WarnEx  (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_Xor  (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyObject_ClearWeakRefs        (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_Subtract     (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PySlice_New   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyObject_GetAttrString        (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyObject_IsInstance   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyRun_StringFlags     (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyObject_SetAttrString        (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyWeakref_NewRef      (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyErr_NewException    (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyList_Append (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyObject_SetAttr      (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyDict_GetItemString  (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_InPlaceDivide        (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyLong_AsLongLong     (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyLong_AsUnsignedLongLong     (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_Or   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyObject_DelItem      (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyNumber_InPlaceSubtract      (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyMethod_New  (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyEval_CallFunction   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PySequence_GetSlice   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyTuple_Size  (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyImport_ImportModule (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyErr_Clear   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyTuple_New   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyTuple_GetItem       (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyErr_SetString       (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyObject_CallFunction (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyList_Reverse        (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyFile_FromString     (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: _PyType_Lookup        (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyList_New    (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyMem_Malloc  (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyCallable_Check      (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyDict_Clear  (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PySequence_SetSlice   (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyLong_AsUnsignedLong (/usr/lib64/libboost_python.so.1.54.0)
undefined symbol: PyDict_New    (/usr/lib64/libboost_python.so.1.54.0)

--- Additional comment from Rex Dieter on 2014-05-29 08:33:33 EDT ---

Looks like this may be on purpose,
https://svn.boost.org/trac/boost/ticket/2615

--- Additional comment from Petr Machata on 2014-05-29 14:15:40 EDT ---

Filed https://svn.boost.org/trac/boost/ticket/10079 for this.

We will need at least the patch that I'm attaching in addition to the patchled in the referenced bug, as currently on Fedora we have libpython3.2m.so, not libpython3.2.so.  I will possibly open a separate bug to track this depending on how the referenced bug evolves.

--- Additional comment from Petr Machata on 2015-01-09 15:46:43 EST ---

The following is another upstream ticket somewhat tangential to this issue (in that the Boost.Python test suite fails, although it likely fails irrespective of whether we apply the DT_NEEDED patches):
  https://svn.boost.org/trac/boost/ticket/10923

The patches make the test fail because then -lpythonXY is brought in, and exec test fails, because it requests static linking, and we don't ship static -lpython in Fedora.  exec-dynamic works though, and I'm somewhat inclined to dismiss this failure.

Comment 1 Jonathan Wakely 2016-05-26 09:16:09 UTC
Fixing this in Fedora caused bogus RPATH entries in all Boost libraries, see Bug 1318383

I'd like to avoid that for RHEL.

Comment 2 Yaakov Selkowitz 2016-05-27 19:27:23 UTC
(In reply to Jonathan Wakely from comment #1)
> Fixing this in Fedora caused bogus RPATH entries in all Boost libraries, see
> Bug 1318383

See bug 1318383 comment 7 for a possible fix.

Comment 3 Jonathan Wakely 2016-06-10 14:15:07 UTC
I have the fix for this ready but it needs the rhel-7.3.0 ack before I can push it and build an update.

Comment 6 Miloš Prchlík 2016-07-04 08:37:17 UTC
Verified for build boost-1.53.0-26.el7.

Comment 8 errata-xmlrpc 2016-11-04 06:32:58 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHEA-2016-2442.html