[OE-core] Broken toolchain/SDK installation (master and dizzy)

Paul Eggleton paul.eggleton at linux.intel.com
Wed Jan 21 17:01:12 UTC 2015


On Wednesday 21 January 2015 11:18:18 Viguera, Javier wrote:
> Seems that there is a problem with the toolchain installation script when
> you try to install it in a path which is not the default one but is derived
> from it (i.e. the default path is a prefix of the real installation path)
> 
> To reproduce it I just used poky as layer, configured a project for qemuarm
> and built a toolchain with:
> 
> # bitbake -c populate_sdk core-image-minimal
> 
> Once finished I installed the toolchain:
> 
> $ ./poky-glibc-x86_64-core-image-minimal-armv5te-toolchain-1.7.sh
> Enter target directory for SDK (default: /opt/poky/1.7):
> /opt/poky/1.7-custom You are about to install the SDK to
> "/opt/poky/1.7-custom". Proceed[Y/n]?Y ...
> 
> If we now have a look at the environment file
> (/opt/poky/1.7-custom/environment-setup-armv5te-poky-linux-gnueabi):
> 
> export
> SDKTARGETSYSROOT=/opt/poky/1.7-custom-custom/sysroots/armv5te-poky-linux-gn
> ueabi export
> PATH=/opt/poky/1.7-custom-custom/sysroots/x86_64-pokysdk-linux/usr/bin:/opt
> /poky/1.7-custom-custom/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux
> -gnueabi:$PATH export
> CCACHE_PATH=/opt/poky/1.7-custom-custom/sysroots/x86_64-pokysdk-linux/usr/b
> in:/opt/poky/1.7-custom-custom/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pok
> y-linux-gnueabi:$CCACHE_PATH export
> CONFIG_SITE=/opt/poky/1.7-custom-custom/site-config-armv5te-poky-linux-gnue
> abi export
> OECORE_NATIVE_SYSROOT="/opt/poky/1.7-custom-custom/sysroots/x86_64-pokysdk-
> linux" export OECORE_ACLOCAL_OPTS="-I
> /opt/poky/1.7-custom-custom/sysroots/x86_64-pokysdk-linux/usr/share/aclocal
> " export
> PYTHONHOME=/opt/poky/1.7-custom-custom/sysroots/x86_64-pokysdk-linux/usr
> 
> See the paths are wrong (/opt/poky/1.7-custom-custom)
> 
> Digging into this I see the problem come from
> 'poky/meta/files/toolchain-shar-template.sh' where there are two rounds
> where the environment file is path-fixed. First:
> 
> # fix environment paths
> for env_setup_script in `ls $target_sdk_dir/environment-setup-*`; do
>         $SUDO_EXEC sed -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" -i
> $env_setup_script done
> 
> In my example this first step does the change: /opt/poky/1.7 ->
> /opt/poky/1.7-custom
> 
> But later in this script we have:
> 
> for replace in "$target_sdk_dir -maxdepth 1" "$native_sysroot"; do
>         $SUDO_EXEC find $replace -type f -exec file '{}' \; | \
>                 grep ":.*\(ASCII\|script\|source\).*text" | \
>                 awk -F':' '{printf "\"%s\"\n", $1}' | \
>                 $SUDO_EXEC xargs -n32 sed -i -e
> "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" done
> 
> This loop finds *again* the 'environment-setup' file and because at this
> point we have the correct path '/opt/poky/1.7-custom' in the environment
> file it matches again against the default dir '/opt/poky/1.7' resulting in
> the replacement: /opt/poky/1.7-custom -> /opt/poky/1.7-custom-custom that
> we have at the end.
> 
> A possible workaround is to filter out the environment file in the second
> loop:
> 
> for replace in "$target_sdk_dir -maxdepth 1" "$native_sysroot"; do
>         $SUDO_EXEC find $replace -type f -not -name 'environment-setup-*'
> -exec file '{}' \; | \ grep ":.*\(ASCII\|script\|source\).*text" | \
>                 awk -F':' '{printf "\"%s\"\n", $1}' | \
>                 $SUDO_EXEC xargs -n32 sed -i -e
> "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" done
> 
> But I'm not sure if this is the proper fix or not.

I can't necessarily comment on whether this is the best fix, but FWIW I had 
noticed this and filed a bug for it already:

  https://bugzilla.yoctoproject.org/show_bug.cgi?id=7032

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre



More information about the Openembedded-core mailing list