Bug 9226

Summary: python3: do_configure failed on meta-fsl-ppc with MACHINE = "p1022ds"
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Hongxu Jia <hongxu.jia>
Component: coreAssignee: Hongxu Jia <hongxu.jia>
Status: VERIFIED FIXED QA Contact: Bogdan Alexandru Voiculescu <bogdanx.a.voiculescu>
Severity: normal    
Priority: High CC: bogdanx.a.voiculescu, meta.mr.watcher, meta.watcher
Version: 2.2   
Target Milestone: 2.1 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Hongxu Jia 2016-03-08 08:08:26 UTC
In the log, we have do_configure failed on python3:
...
| checking for the platform triplet based on compiler characteristics... powerpc-linux-gnuspe
| configure: error: internal configure error for the platform triplet, please file a bug report
| NOTE: The following config.log files may provide further information.
...


vim configure.ac in python3 source
...
 852 if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
 853   if test x$PLATFORM_TRIPLET != x$MULTIARCH; then
 854     AC_MSG_ERROR([internal configure error for the platform triplet, please file a bug report])
 855   fi
 856 fi
...

In this case, PLATFORM_TRIPLET is powerpc-linux-gnuspe, and MULTIARCH is
MULTIARCH=$($CC --print-multiarch 2>/dev/null), and both of them are not equivalent.

On my local build with MACHINE = "qemux86-64", the MULTIARCH is empty.

On my local build with MACHINE = "p1022ds", $CC --print-multiarch
powerpc-linux-gnuspev1

Extra 'v1' casued the failure.
Comment 1 Hongxu Jia 2016-03-09 05:09:21 UTC
For powerpc*-*-*spe*, default to with_cpu=8548 if --enable-e500-double,
and to 8540 otherwise.
vim gcc/config.gcc
...
    powerpc*-*-*spe*)
      if test x$enable_e500_double = xyes; then 
         with_cpu=8548
      else 
         with_cpu=8540
      fi     
      ;;
...

The with_cpu is used for SPE version detection
vim ./gcc/config/rs6000/t-linux
...
  7 ifneq (,$(findstring spe,$(target)))
  8 MULTIARCH_DIRNAME := powerpc-linux-gnuspe$(if $(findstring 8548,$(with_cpu)),,v1)
  9 else
 10 MULTIARCH_DIRNAME := powerpc-linux-gnu
...

The variable MULTIARCH_DIRNAME is the output of '$CC --print-multiarch'.
Without this patch, the output is 'powerpc-linux-gnuspev1' which caused
python3 do_configure failed.

Since ppce500v2 -mcpu is 8548, explicitly add --enable-e500-double could fix
the issue.
Comment 2 Hongxu Jia 2016-03-14 02:38:04 UTC
Here is RP reply:

Following the links does give more context. The "bad" triplet is
actually coming from gcc and Hongxu's original patch did change gcc to
"fix" it. Unfortunately it does so at the risk of other problems to
gcc.

The gcc-cross recipes aren't working entirely correctly at the moment
and its just good luck (and sstate) which are meaning things do
actually work out.

The trouble is that changing gcc right now to fix this properly isn't
something we can easily do. So this patch might be the right short term
workaround.

Cheers,

Richard
Comment 4 Bogdan Alexandru Voiculescu 2016-05-05 12:34:36 UTC
Verified on 

Build Configuration:
BB_VERSION        = "1.31.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "universal"
TARGET_SYS        = "powerpc-poky-linux-gnuspe"
MACHINE           = "p1022ds"
DISTRO            = "poky"
DISTRO_VERSION    = "2.1+snapshot-20160505"
TUNE_FEATURES     = "m32 spe ppce500v2"
TARGET_FPU        = "ppc-efd"
meta
meta-poky
meta-yocto-bsp    = "master:f7b520878babbaa7527151f22c031ae160512753"
meta-fsl-ppc      = "master:cd0ba65d48ec067775297f859084913dfe10a180"