From fe32e09ccbef3a9896955e8d4c3113c53f95de48 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Thu, 12 Apr 2012 21:33:22 -0700 Subject: gcc-4.7: Let cpp specs honor include searches in relocated install tree Fix from Yocto Bug 2074 Signed-off-by: Khem Raj --- meta/recipes-devtools/gcc/gcc-4.7.inc | 6 ++++ .../gcc/gcc-4.7/cpp-honor-sysroot.patch | 40 ++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 meta/recipes-devtools/gcc/gcc-4.7/cpp-honor-sysroot.patch (limited to 'meta/recipes-devtools') diff --git a/meta/recipes-devtools/gcc/gcc-4.7.inc b/meta/recipes-devtools/gcc/gcc-4.7.inc index 7cfc388b7..784a3be32 100644 --- a/meta/recipes-devtools/gcc/gcc-4.7.inc +++ b/meta/recipes-devtools/gcc/gcc-4.7.inc @@ -63,6 +63,7 @@ SRC_URI = "svn://gcc.gnu.org/svn/gcc/branches;module=${BRANCH};proto=http \ file://pr32219.patch \ file://fortran-cross-compile-hack.patch \ file://libgcc-sjlj-check.patch \ + file://cpp-honor-sysroot.patch \ " S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/${BRANCH}" @@ -103,6 +104,11 @@ EXTRA_OECONF_INTERMEDIATE = "--disable-libmudflap \ EXTRA_OECONF_append_libc-uclibc = " --disable-decimal-float " +EXTRA_OECONF_PATHS = " \ + --with-gxx-include-dir=${STAGING_DIR_TARGET}${target_includedir}/c++ \ + --with-sysroot=${STAGING_DIR_TARGET} \ + --with-build-sysroot=${STAGING_DIR_TARGET}" + do_configure_prepend () { # teach gcc to find correct target includedir when checking libc ssp support mkdir -p ${B}/gcc diff --git a/meta/recipes-devtools/gcc/gcc-4.7/cpp-honor-sysroot.patch b/meta/recipes-devtools/gcc/gcc-4.7/cpp-honor-sysroot.patch new file mode 100644 index 000000000..731067741 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.7/cpp-honor-sysroot.patch @@ -0,0 +1,40 @@ +Currently, if the gcc toolchain is relocated and installed from sstate, then you try and compile +preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location +rather than the --sysroot option specified on the commandline. If access to that directory is +permission denied (unreadable), gcc will error. + +This happens when ccache is in use due to the fact it uses preprocessed source files. + +The fix below adds %I to the cpp-output spec macro so the default substitutions for -iprefix, +-isystem, -isysroot happen and the correct sysroot is used. + +[YOCTO #2074] + +Upstream-Status: Pending + +RP 2012/04/13 + +Index: gcc-4_6-branch/gcc/gcc.c +=================================================================== +--- gcc-4_6-branch.orig/gcc/gcc.c 2012-04-13 12:24:37.939671140 +0000 ++++ gcc-4_6-branch/gcc/gcc.c 2012-04-13 12:24:54.439670688 +0000 +@@ -953,7 +953,7 @@ + %W{o*:--output-pch=%*}}%V}}}}}}", 0, 0, 0}, + {".i", "@cpp-output", 0, 0, 0}, + {"@cpp-output", +- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, ++ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, + {".s", "@assembler", 0, 0, 0}, + {"@assembler", + "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0}, +Index: gcc-4_6-branch/gcc/cp/lang-specs.h +=================================================================== +--- gcc-4_6-branch.orig/gcc/cp/lang-specs.h 2012-04-13 12:25:01.019670594 +0000 ++++ gcc-4_6-branch/gcc/cp/lang-specs.h 2012-04-13 12:25:07.567670180 +0000 +@@ -64,5 +64,5 @@ + {".ii", "@c++-cpp-output", 0, 0, 0}, + {"@c++-cpp-output", + "%{!M:%{!MM:%{!E:\ +- cc1plus -fpreprocessed %i %(cc1_options) %2\ ++ cc1plus -fpreprocessed %i %I %(cc1_options) %2\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, -- cgit v1.2.3