Bug 7081

Summary: glibc test suite fails to build some programs
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Juro Bystricky <juro.bystricky>
Component: coreAssignee: Juro Bystricky <juro.bystricky>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: meta.mr.watcher, meta.watcher
Version: unspecified   
Target Milestone: 1.8 M4   
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
Patch to detect g++ system header files
none
Patch to determine location of g++ system header files none

Description Juro Bystricky 2014-12-12 23:14:53 UTC
Created attachment 2297 [details]
Patch to detect g++ system header files

The following programs from the glibc test suite fail to build:

/elf/tst-unique3cc
/elf/tst-unique4cc
/elf/tst-unique3lib.cc
/elf/tst-unique3lib2.cc

in all cases the error is:

fatal error: cstdio: No such file or directory
 #include <cstdio>

The reason is the c++ header files were not found by the g++.
g++ was invoked with -nostdinc flag, and in that case the path to system include
files must be specified explicitly. The glibc "configure" contains some code to detect
the g++ system headers file location, but it does not work correctly.
For example, it uses g++ itself to query for the location of the header files,
but g++ may not be present at all at the cofigure time. Also, the algorithm used
to detect the header file location does not seem to work with g++ anymore.
Even if g++ is present the resulting config.log shows:
CXX_SYSINCLUDES=''

To fix the problem, the location of the include headers should be determined before 
running the test suite, not before building glibc.

The proposed solution modifies /meta/recipes-core/glibc/glibc-testing.inc. The new code 
cracks "configparms" to get the actual CXX and sysroot used for the glibc test suite, then 
uses CXX to determine CXX version and CXX machine. 
Based on the results, it composes a new value for c++-sysincludes 
and appends "configparms" with the new value.

The header locations are assumed to be:
    sysroot/usr/include/c++/<version>
    sysroot/usr/include/c++/<version>/<machine>

This was so far successfully tested on qemux86-64.
Comment 1 Juro Bystricky 2014-12-13 02:59:18 UTC
Also tested fine on qemumips.
Comment 2 Juro Bystricky 2014-12-15 19:04:17 UTC
The fix I described previously (but a bit more paranoid) is being tested. The fix is quite safe, it does not affect glibc build at all, it only modifies the testing script. 

If there are no c++-sysincludes specified in config.make, then the location of the headers is determined by querying the CXX compiler as specified in configparms.
If the corresponding folders do exist in the <sysroot> (as specified by configparms as well) then tew value of c++-sysincludes is written to the configparms as well, overriding the previous empty definition.

If the config.make contains a value for c++-sysincludes, then it is assumed
to be correct and the testing is done as before without any changes.
Comment 3 Juro Bystricky 2015-03-25 15:07:00 UTC
The problem remains also with glibc 2.21.
Posted a patch that fixes the problem.
Comment 4 Juro Bystricky 2015-03-25 15:10:03 UTC
Created attachment 2453 [details]
Patch to determine location of g++ system header files
Comment 5 Juro Bystricky 2015-04-03 16:00:48 UTC
Merged to trunk commit: 47dedbcb52702539b124ecf43cf53e4c3b7b3b33