All of lore.kernel.org
 help / color / mirror / Atom feed
* Broken toolchain/SDK installation (master and dizzy)
@ 2015-01-21 11:18 Viguera, Javier
  2015-01-21 17:01 ` Paul Eggleton
  0 siblings, 1 reply; 3+ messages in thread
From: Viguera, Javier @ 2015-01-21 11:18 UTC (permalink / raw)
  To: 'OE-core'

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.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Broken toolchain/SDK installation (master and dizzy)
  2015-01-21 11:18 Broken toolchain/SDK installation (master and dizzy) Viguera, Javier
@ 2015-01-21 17:01 ` Paul Eggleton
  2015-01-22 10:56   ` Viguera, Javier
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Eggleton @ 2015-01-21 17:01 UTC (permalink / raw)
  To: Viguera, Javier; +Cc: openembedded-core

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Broken toolchain/SDK installation (master and dizzy)
  2015-01-21 17:01 ` Paul Eggleton
@ 2015-01-22 10:56   ` Viguera, Javier
  0 siblings, 0 replies; 3+ messages in thread
From: Viguera, Javier @ 2015-01-22 10:56 UTC (permalink / raw)
  To: 'Paul Eggleton'
  Cc: 'openembedded-core@lists.openembedded.org'

Hi Paul,

On 21/01/15 18:01, Paul Eggleton wrote:
> 
> 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

Thanks for the heads-up. I will keep an eye on it.

The thing that worries me is that Dizzy is affected, including the prebuilt toolchains/buildtools from:

http://downloads.yoctoproject.org/releases/yocto/yocto-1.7.1/buildtools/
http://downloads.yoctoproject.org/releases/yocto/yocto-1.7.1/toolchain/

So it's probably worth updating the bugzilla saying that Dizzy needs a backport once fixed in master.

-
Regards,

Javier Viguera



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-22 11:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-21 11:18 Broken toolchain/SDK installation (master and dizzy) Viguera, Javier
2015-01-21 17:01 ` Paul Eggleton
2015-01-22 10:56   ` Viguera, Javier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.