[OE-core] [PATCH 1/2] gcc-cross-canadian: Adjust $prefix to fix sysroot autodetect

Richard Tollerton rich.tollerton at ni.com
Mon Jul 28 17:25:22 UTC 2014


Bump?

Richard Tollerton <rich.tollerton at ni.com> writes:

> Currently, using gcc-cross-canadian often requires --sysroot to be
> specified at compile time, because the default sysroot is hardcoded to
> e.g. /opt/poky/1.6.1/sysroots/core2-64-poky-linux. If you didn't install
> the toolchain in precisely that location, the default sysroot won't work.
>
> But that isn't actually necessary -- gcc is actually capable of
> discovering the sysroot location itself. If the default
> sysroot (--with-sysroot=) is underneath the prefix (--prefix=), then gcc
> rewrites the sysroot at runtime based on the actual location of gcc in
> the filesystem. (cf gcc/gcc.c:process_command() in the
> defined(TARGET_SYSTEM_ROOT_RELOCATABLE), and
> libiberty/make-relative-prefix.c, in the gcc sources.)
>
> We can effect this by moving prefix up a few directories.
> Currently it's effectively set to ${SDKPATH}/sysroots/${SDK_SYS}/usr,
> via nativesdk.bbclass. So instead, set it to ${SDKPATH}/sysroots.
> This breaks nothing, because autotools.bbclass already sets
> exec_prefix, bindir, etc. so that this change should not actually affect
> where files get installed.
>
> Natinst-ReviewBoard-ID: 52189
> Acked-by: Gratian Crisan <gratian.crisan at ni.com>
> Acked-by: David Curtiss <david.curtiss at ni.com>
> Signed-off-by: Richard Tollerton <rich.tollerton at ni.com>
> ---
>  meta/recipes-devtools/gcc/gcc-cross-canadian.inc | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
> index 63adae8..1a826ec 100644
> --- a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
> +++ b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
> @@ -37,6 +37,9 @@ export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib"
>  export STRIP_FOR_TARGET = "${TARGET_PREFIX}strip"
>  export WINDRES_FOR_TARGET = "${TARGET_PREFIX}windres"
>  
> +# Ensure that the target sysroot is under the prefix
> +prefix = "${SDKPATH}/sysroots"
> +
>  #
>  # We need to override this and make sure the compiler can find staging
>  #
> -- 
> 2.0.1
>

-- 
Richard Tollerton <rich.tollerton at ni.com>



More information about the Openembedded-core mailing list