Bug 11104

Summary: boost libboost_python3.so.1.62.1 links incorrectly against Python 2 C API
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Ismo Puustinen <ismo.puustinen>
Component: coreAssignee: Ross Burton <ross.burton>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: lukas.bulwahn, meta.mr.watcher, meta.watcher
Version: unspecified   
Target Milestone: 2.3 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Ismo Puustinen 2017-02-24 09:46:41 UTC
Using libboost_python3 from any project fails with an "undefined reference" linking problem, because libboost_python3.so.1.62.0 appears to be built incorrectly against Python 2 includes and uses symbols which are not present in Python 3 C library.

libboost_python.so (Python 2) uses PyClass_Type, which is fine:

nm -D tmp-glibc/work/corei7-64-refkit-linux/boost/1.62.0-r1/sysroot-destdir/usr/lib/libboost_python.so.1.62.0 | grep PyClass_Type
                 U PyClass_Type

However, libboost_python3.so also uses the same symbol, which is not fine:

nm -D tmp-glibc/work/corei7-64-refkit-linux/boost/1.62.0-r1/sysroot-destdir/usr/lib/libboost_python3.so.1.62.0 | grep PyClass_Type
                 U PyClass_Type

Looking at the Python C libraries we can see that the symbol is prsent only in Python 2:

nm -D tmp-glibc/work/corei7-64-refkit-linux/boost/1.62.0-r1/recipe-sysroot/usr/lib/libpython3.5m.so | grep PyClass_Type
nm -D tmp-glibc/work/corei7-64-refkit-linux/boost/1.62.0-r1/recipe-sysroot/usr/lib/libpython2.7.so | grep PyClass_Type
000000000038e420 D PyClass_Type

There's some discussion about the issue here:

http://stackoverflow.com/questions/25188861/libboost-python3-so-1-56-0-undefined-symbol-pyclass-type
Comment 1 Ross Burton 2017-03-24 16:08:26 UTC
I'm sending a patch to port boost from py2 to py3, so if Python is enabled in boost it only builds against Py3.
Comment 2 Ross Burton 2017-03-24 16:15:46 UTC
*** Bug 11152 has been marked as a duplicate of this bug. ***
Comment 3 Ross Burton 2017-03-30 13:00:23 UTC
Fixed in oe-core 0f5418eb0ce12811b16d2e3c28c28140a509f685.