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

Viguera, Javier Javier.Viguera at digi.com
Wed Jan 21 11:18:18 UTC 2015


Hi all,

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-gnueabi
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/bin:/opt/poky/1.7-custom-custom/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi:$CCACHE_PATH
export CONFIG_SITE=/opt/poky/1.7-custom-custom/site-config-armv5te-poky-linux-gnueabi
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.

Comments?

-
Thanks,

Javier Viguera
Software Engineer
Digi International(r) Spain S.A.U.




More information about the Openembedded-core mailing list