mirror of
https://git.yoctoproject.org/poky
synced 2026-04-29 09:32:11 +02:00
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
(From OE-Core rev: 28b772e42a20faebe1b4f415d28b42b7e0a424fb)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
49 lines
2.0 KiB
PHP
49 lines
2.0 KiB
PHP
require gcc-configure-common.inc
|
|
|
|
# The two lines below conflict, this needs fixing - RP
|
|
USE_NLS = '${@base_conditional( "TARGET_OS", "linux-uclibc", "no", "", d )}'
|
|
USE_NLS = '${@base_conditional( "TARGET_OS", "linux-uclibceabi", "no", "", d )}'
|
|
|
|
EXTRA_OECONF_PATHS = "--with-local-prefix=${SDKPATH}/sysroots/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}${target_exec_prefix} \
|
|
--with-gxx-include-dir=${SDKPATH}/sysroots/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}${target_includedir}/c++ \
|
|
--with-build-time-tools=${STAGING_DIR_NATIVE}${prefix_native}/${TARGET_SYS}/bin \
|
|
--with-sysroot=${SDKPATH}/sysroots/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS} \
|
|
--with-build-sysroot=${STAGING_DIR_TARGET}"
|
|
|
|
#
|
|
# gcc-cross looks and finds these in ${exec_prefix} but we're not so lucky
|
|
# for the sdk. Hardcoding the paths ensures the build doesn't go canadian or worse.
|
|
#
|
|
export AR_FOR_TARGET = "${TARGET_PREFIX}ar"
|
|
export AS_FOR_TARGET = "${TARGET_PREFIX}as"
|
|
export DLLTOOL_FOR_TARGET = "${TARGET_PREFIX}dlltool"
|
|
export CC_FOR_TARGET = "${TARGET_PREFIX}gcc"
|
|
export CXX_FOR_TARGET = "${TARGET_PREFIX}g++"
|
|
export LD_FOR_TARGET = "${TARGET_PREFIX}ld"
|
|
export LIPO_FOR_TARGET = "${TARGET_PREFIX}lipo"
|
|
export NM_FOR_TARGET = "${TARGET_PREFIX}nm"
|
|
export OBJDUMP_FOR_TARGET = "${TARGET_PREFIX}objdump"
|
|
export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib"
|
|
export STRIP_FOR_TARGET = "${TARGET_PREFIX}strip"
|
|
export WINDRES_FOR_TARGET = "${TARGET_PREFIX}windres"
|
|
|
|
#
|
|
# We need to override this and make sure the compiler can find staging
|
|
#
|
|
export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}"
|
|
|
|
do_configure () {
|
|
export CC_FOR_BUILD="${BUILD_CC}"
|
|
export CXX_FOR_BUILD="${BUILD_CXX}"
|
|
export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
|
|
export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
|
|
export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
|
|
export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
|
|
(cd ${S} && gnu-configize) || die "failure running gnu-configize"
|
|
oe_runconf
|
|
}
|
|
|
|
do_compile () {
|
|
oe_runmake all-host all-target-libgcc
|
|
}
|