[oe-commits] Khem Raj : gcc-4.6: Let G++ relocate gxx-include-dir when using --sysroot option

git at git.openembedded.org git at git.openembedded.org
Mon Dec 19 09:34:48 UTC 2011


Module: openembedded-core.git
Branch: master
Commit: 28b772e42a20faebe1b4f415d28b42b7e0a424fb
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=28b772e42a20faebe1b4f415d28b42b7e0a424fb

Author: Khem Raj <raj.khem at gmail.com>
Date:   Fri Dec 16 14:33:37 2011 -0800

gcc-4.6: Let G++ relocate gxx-include-dir when using --sysroot option

Currently we have a problem in our cross compiler since we use
/usr/include/c++ to be default gxx-include-dir and then expect
the patch we did to do the relocation w.r.t. sysroot however it
does not quite work so and we end up gxx-include-dirs not respecting
sysroot. A small test case would be

tst-unique4.cc

and it would fails like

tst-unique4.cc:1:18: fatal error: cstdio: No such file or directory
compilation terminated.

weather we use --sysroot or not it does not matter

arm-oe-linux-gnueabi-g++ -S tst-unique4.cc
--sysroot=/home/kraj/work/angstrom/sources/openembedded-core/build/tmp-eglibc/sysroots/qemuarm

failed in same way.

so we redo the GPLUSPLUS_INCLUDE_DIR_with_sysroot.patch based on upstream
submitted patch which tries to relocate the gxx-include-dir and to
achieve the relocation it has to be specified w.r.t to --with-sysroot
directory. e.g.

--with-sysroot=${SYSROOT}
--with-gxx-include-dir=${SYSROOT}/usr/include/c++

if we configure gcc like above then it becomes relocatable when
we run the compiler and specify --sysroot=<blah> then g++ will search
for gxx-headers under <blah>/usr/include/c++

if sysroot is not defined then it will use the default sysroot
and gxx-include-dir will be w.r.t. default sysroot.

Tested on qemuarm

/arm-oe-linux-gnueabi-g++ -S tst-unique4.cc
--sysroot=/home/kraj/work/angstrom/sources/openembedded-core/build/tmp-eglibc/sysroots/qemuarm
-v
...
 /home/kraj/work/angstrom/sources/openembedded-core/build/tmp-eglibc/sysroots/qemuarm/usr/include/c++
 /home/kraj/work/angstrom/sources/openembedded-core/build/tmp-eglibc/sysroots/qemuarm/usr/include/c++/arm-oe-linux-gnueabi
 /home/kraj/work/angstrom/sources/openembedded-core/build/tmp-eglibc/sysroots/qemuarm/usr/include/c++/backward
...

and if I now change --sysroot to something else

/arm-oe-linux-gnueabi-g++ -S tst-unique4.cc
--sysroot=/home/kraj/work/angstrom/sources/openembedded-core/build/tmp-eglibc/sysroots/qemuarm4
-v
...

ignoring nonexistent directory
"/home/kraj/work/angstrom/sources/openembedded-core/build/tmp-eglibc/sysroots/qemuarm4/usr/include/c++"
ignoring nonexistent directory
"/home/kraj/work/angstrom/sources/openembedded-core/build/tmp-eglibc/sysroots/qemuarm4/usr/include/c++/arm-oe-linux-gnueabi"
ignoring nonexistent directory
"/home/kraj/work/angstrom/sources/openembedded-core/build/tmp-eglibc/sysroots/qemuarm4/usr/include/c++/backward"
...

See now its looking for them in 'qemuarm4' sysroot

Signed-off-by: Khem Raj <raj.khem at gmail.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/recipes-devtools/gcc/gcc-4.6.inc              |    4 +-
 .../GPLUSPLUS_INCLUDE_DIR_with_sysroot.patch       |  189 ++++++++++++++++++--
 meta/recipes-devtools/gcc/gcc-configure-cross.inc  |    2 +-
 meta/recipes-devtools/gcc/gcc-configure-sdk.inc    |    2 +-
 4 files changed, 174 insertions(+), 23 deletions(-)

Diff:   http://git.openembedded.org/?p=openembedded-core.git/?a=commitdiff;h=28b772e42a20faebe1b4f415d28b42b7e0a424fb




More information about the Openembedded-commits mailing list