Bug 10142

Summary: SDK sanity test fails to build gpp for qemumip64 multilib
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Bill Randle <bill.randle>
Component: devtools / tool chainAssignee: Juro Bystricky <juro.bystricky>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: juro.bystricky, meta.mr.watcher, meta.watcher, ross.burton, sgw
Version: 2.2   
Target Milestone: 2.2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
g++ 6.1 include search paths none

Description Bill Randle 2016-08-15 16:18:41 UTC
Failure noted on the AutoBuilder for running the SDK sanity test on a qemumips64 multi-lib (64/32) build.

The error messages are:

| In file included from /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-multilib/build/build/tmp/work/qemumips64-poky-linux-gnun32/core-image-minimal/1.0-r0/testimage-sdk//test.cpp:1:0:
| /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-multilib/build/build/tmp/work/qemumips64-poky-linux-gnun32/core-image-minimal/1.0-r0/testimage-sdk/tc/sysroots/mips64-n32-poky-linux-gnun32/usr/include/c++/6.1.1/limits:42:28: fatal error: bits/c++config.h: No such file or directory
|  #include <bits/c++config.h>
|                             ^
| compilation terminated.
| test_gpp2_compile (oeqa.sdk.gcc.GccCompileTest) ... ERROR
| In file included from /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-multilib/build/build/tmp/work/qemumips64-poky-linux-gnun32/core-image-minimal/1.0-r0/testimage-sdk/tc/sysroots/mips64-n32-poky-linux-gnun32/usr/include/c++/6.1.1/math.h:36:0,
|                  from /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-multilib/build/build/tmp/work/qemumips64-poky-linux-gnun32/core-image-minimal/1.0-r0/testimage-sdk//test.c:2:
| /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-multilib/build/build/tmp/work/qemumips64-poky-linux-gnun32/core-image-minimal/1.0-r0/testimage-sdk/tc/sysroots/mips64-n32-poky-linux-gnun32/usr/include/c++/6.1.1/cmath:41:28: fatal error: bits/c++config.h: No such file or directory
|  #include <bits/c++config.h>
|                             ^
| compilation terminated.
| test_gpp_compile (oeqa.sdk.gcc.GccCompileTest) ... ERROR

[See https://autobuilder.yoctoproject.org/main/builders/nightly-multilib/builds/903/steps/Running%20SDK%20Sanity%20Tests/logs/stdio for full log]

The build configuration is:
MACHINE = "qemumips64"
require conf/multilib.conf
MULTILIBS = "multilib:lib64 multilib:lib32"
DEFAULTTUNE = "mips64-n32"
DEFAULTTUNE_virtclass-multilib-lib64 = "mips64"
DEFAULTTUNE_virtclass-multilib-lib32 = "mips32r2"

To duplicate the bug, the steps to add to nightly-multilib.conf on an AB are:
        {'CreateAutoConf': {'machine': 'qemumips64', 'SDKMACHINE' : 'x86_64',
                            'buildhistory' : False,
                            'distro': 'poky',
                            'atextappend' : '\nrequire conf/multilib.conf\nMULTILIBS = "multilib:lib64 multilib:lib32"\nDEFAULTTUNE = "mips64-n32"\nDEFAULTTUNE_virtclass-multilib-lib64 = "mips64"\nDEFAULTTUNE_virtclass-multilib-lib32 = "mips32r2"\n'}},
        {'BuildImages': {'images': '-c populate_sdk core-image-minimal'}},
        {'RunSDKSanityTests': {'images': 'core-image-minimal'}},
Comment 1 Juro Bystricky 2016-08-16 15:03:04 UTC
I tried to reproduce the problem with:
MACHINE="qemumips64"
SDKMACHINE="x86_64"
require conf/multilib.conf
MULTILIBS = "multilib:lib64 multilib:lib32"
DEFAULTTUNE = "mips64-n32"
DEFAULTTUNE_virtclass-multilib-lib64 = "mips64"
DEFAULTTUNE_virtclass-multilib-lib32 = "mips32r2"

$ bitbake core-image-minimal -c populate_sdk

I received a bunch of warnings 
/data/master5/poky/build-mips-10142/tmp/sstate-control/manifest-qemumips64-glibc-initial.populate_sysroot not found

but the SDK built fine. (Did not check the functionality, just build)

I will re-try with pristine build.
Comment 2 Juro Bystricky 2016-08-16 15:05:33 UTC
I forgot to mention I used the commit 2a859db7a29063c63ff317c27c87eba84f6974d7.
Comment 3 Ross Burton 2016-08-16 15:37:47 UTC
Juro: the SDK builds fine, it's the sanity tests that fail.
Comment 4 Juro Bystricky 2016-08-16 16:49:24 UTC
(In reply to comment #3)
> Juro: the SDK builds fine, it's the sanity tests that fail.

d'oh!
Comment 5 Juro Bystricky 2016-08-16 18:19:13 UTC
Created attachment 3362 [details]
g++ 6.1 include search paths
Comment 6 Juro Bystricky 2016-08-16 18:19:28 UTC
The file c++config.h does exist, but it is not found.
When dumping CPP search path, I see some anomalies, i.e. non-existent directories.
(See the attached file)

steps:
1. install sdk
2. source ~/mips-multilib-10142/environment-setup-mips64-n32-poky-linux-gnun32 
3. $CPP -E -x c++ - -v < /dev/null
Comment 7 Juro Bystricky 2016-08-25 23:01:28 UTC
A few additional observations:

MACHINE="qemumips64"
SDKMACHINE="x86_64"
USER_CLASSES += " testsdk " 

bitbake core-image-minimal -c populate_sdk
bitbake core-image-minimal -c testsdk

PASS

MACHINE="qemumips64"
SDKMACHINE="x86_64"
DEFAULTTUNE = "mips64-n32"
USER_CLASSES += " testsdk " 

bitbake core-image-minimal -c populate_sdk
bitbake core-image-minimal -c testsdk

FAIL

The fail is identical to the multilib failure:
error: bits/c++config.h: No such file or directory
|  #include <bits/c++config.h>

So strictly speaking, not really a multilib problem.
Comment 8 Juro Bystricky 2016-08-27 17:02:43 UTC
The root cause of the problem is CPP is not looking into the correct directory to find c++config.h, as it is built with incorrect path.

The problem is easy to illustrate with a simple MIPS  SDK (no multilib) with explicit tuning:
DEFAULTTUNE = "mips64-n32"

$ $CPP -E -x c++ - -v < /dev/null
...
ignoring nonexistent directory:
 "<path>/sysroots/mips64-n32-poky-linux-gnun32/usr/include/c++/6.1.1/mips64-poky-linux/."
...

The directory where the file is actually located is:
<path>/sysroots/mips64-n32-poky-linux-gnun32/usr/include/c++/6.1.1/mips64-poky-linux-gnun32/.


Once I created the non-existent directory (as a symlink to the existing to the existing directory), then test.cpp compiles without errors. 

The remedy would be to build the cross-compiler which searches into correct directory, based on multilib/tuning as opposed to fixed location "mips64-poky-linux.

(For multilibs, there can be several directories side by side, corresponding to each compiler. These directories have different contents, so the naming is correct and it is not possible to solve this with symlinks as in the simple case pf a single CPP with "modified" tuning)
Comment 9 Juro Bystricky 2016-08-29 11:53:52 UTC
It is possible to fix this by adding missing symlinks.
The fix is only needed when ${TARGET_OS} = linux-gnun32
(Two variations of symlinks are needed, depending if we are building multilib SDK or not.)
Comment 10 Juro Bystricky 2016-08-29 22:49:30 UTC
patch sent to the mailing list:
http://lists.openembedded.org/pipermail/openembedded-core/2016-August/125883.html