Bug 8467

Summary: Can't build nativesdk-python3
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Gary Thomas <gary>
Component: devtools / tool chainAssignee: Alejandro Hernandez <alejandro.hernandez>
Status: VERIFIED FIXED QA Contact: Bogdan Alexandru Voiculescu <bogdanx.a.voiculescu>
Severity: normal    
Priority: Medium+ CC: bogdanx.a.voiculescu, meta.mr.watcher, meta.watcher
Version: unspecified   
Target Milestone: 2.1 M1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know
Attachments:
Description Flags
Compile log none

Description Gary Thomas 2015-10-08 21:22:49 UTC
In Poky/Yocto master:eac61f37e36099f74485dab398b57f3812826d17

$ bitbake nativesdk-python3
Build Configuration:
BB_VERSION        = "1.28.0"
BUILD_SYS         = "i686-linux"
NATIVELSBSTRING   = "Fedora-18"
TARGET_SYS        = "arm-poky-linux-gnueabi"
MACHINE           = "qemuarm"
DISTRO            = "poky"
DISTRO_VERSION    = "2.0"
TUNE_FEATURES     = "arm armv5 thumb dsp"
TARGET_FPU        = "soft"
meta
meta-yocto        
meta-yocto-bsp    = "master:eac61f37e36099f74485dab398b57f3812826d17"

| Objects/obmalloc.o: In function `_PyObject_DebugMallocStats':
| obmalloc.c:(.text+0x13ea): undefined reference to `pool_is_in_list'
Comment 1 Gary Thomas 2015-10-08 21:28:35 UTC
Created attachment 2790 [details]
Compile log
Comment 2 Alejandro Hernandez 2015-11-23 22:29:02 UTC
I can confirm this isn't working, I get the exact same error, for some reason the linker isn't able to find a declaration of pool_is_in_list (), although grepping for it shows its there:

# grep -R pool_is_in_list
Binary file Objects/obmalloc.o matches
Comment 3 Alejandro Hernandez 2015-11-23 23:13:08 UTC
pool_is_in_list () is conditionally declared, when Py_DEBUG is enabled, passing the flag --with-pydebug to configure, seems to set Py_DEBUG correctly and fix the issue, but we need to understand why it is requesting this flag to be set top avoid the overhead of enabling Py_DEBUG
Comment 4 Alejandro Hernandez 2015-11-23 23:15:02 UTC
Also if the error is fixed manually, another error pops up:

| ./libpython3.4m.so: undefined reference to `_PyUnicode_CheckConsistency' 
| collect2: error: ld returned 1 exit status 
| make: *** [python] Error 1 

Another undefined reference error, where _PyUnicode_CheckConsistency() is also conditionally declared if PyDEBUG is enabled.
Comment 5 Alejandro Hernandez 2015-11-24 00:05:02 UTC
The question is: why building python3 does not produce this error?, but when building nativesdk-python3 it does, something is triggering debug when inheriting nativesdk.bbclass, so we either need to enable debug via configure (since its expecting it) or presumably if we could avoid it in the first place, it would also fix the problem.
Comment 6 Alejandro Hernandez 2015-11-24 16:10:22 UTC
The python3 recipe, declares:

TARGET_CC_ARCH += "-DNDEBUG -fno-inline"

which disables debug.

But, since we use BBCLASSEXTEND = "nativesdk" later on, on the nativesdk.bbclass we redefine it to:

TARGET_CC_ARCH = "${SDK_CC_ARCH}"

and this ends  up causing the error, will be sending patch soon.
Comment 8 Bogdan Alexandru Voiculescu 2016-01-06 13:40:21 UTC
Verified on: master
bitbake nativesdk-python3
Loading cache: 100% |############################################################################################################################################################| ETA:  00:00:00
Loaded 1315 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = "1.28.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Ubuntu-14.04"
TARGET_SYS        = "arm-poky-linux-gnueabi"
MACHINE           = "beaglebone"
DISTRO            = "poky"
DISTRO_VERSION    = "2.0+snapshot-20160106"
TUNE_FEATURES     = "arm armv7a vfp neon callconvention-hard cortexa8"
TARGET_FPU        = "vfp-neon"
meta
meta-yocto
meta-yocto-bsp    = "master:2cd061a29a94fdcdfec86732e6bcbb71c12c4afc"

NOTE: Preparing RunQueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 528 tasks of which 284 didn't need to be rerun and all succeeded.