Bug 8698

Summary: Toolchain install fails when environment has been previously sourced
Product: [Build System, Metadata & Runtime] OE-Core Reporter: George Nita <george.nita>
Component: devtools / tool chainAssignee: Paul Eggleton <bluelightning>
Status: VERIFIED FIXED QA Contact: Bogdan Alexandru Voiculescu <bogdanx.a.voiculescu>
Severity: normal    
Priority: Medium CC: bogdanx.a.voiculescu, meta.mr.watcher, meta.watcher
Version: 1.7.4   
Target Milestone: 2.1   
Hardware: Other   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description George Nita 2015-11-17 16:56:18 UTC
Build for qemuarm:
bitbake -f -c populate_sdk core-image-minimal
<Copy the script on host>
Install SDK in a clean environment:
./poky-glibc-x86_64-core-image-minimal-armv5te-toolchain-1.7.3.sh -d toolchain1 -y
'SDK has been successfully set up and is ready to be used.'

source toolchain1/environment-setup-armv5te-poky-linux-gnueabi
rm -rf toolchain1/*

Try installing SDK again:
./poky-glibc-x86_64-core-image-minimal-armv5te-toolchain-1.7.3.sh -d toolchain1 -y
You are about to install the SDK to ".../toolchain1". Proceed[Y/n]?Y
Extracting SDK...done
Setting it up...toolchain1/sysroots/x86_64-pokysdk-linux/usr/bin/python: line 4: .../toolchain1/sysroots/x86_64-pokysdk-linux/usr/bin/python2.7.real: No such file or directory
SDK could not be set up. Relocate script failed. Abort!

This occurred on dizzy, 1.7.3. Hosts were Ubuntu-14.04 and Ubuntu-14.04.3

The cause is that the environment no longer fits the host, but the toolchain.
Comment 2 Paul Eggleton 2015-11-24 22:36:00 UTC
Thanks for the patch - I replied on the mailing list; I've queued this up with some other fixes I will send out soon.
Comment 3 George Nita 2015-11-25 14:28:01 UTC
Issue is reproducible on master too:
source environment-setup-armv5e-poky-linux-gnueabi
cd ..
rm -rf toolchain1/*
./poky-glibc-x86_64-core-image-minimal-armv5e-toolchain-2.0.sh -d ..../toolchain1
Poky (Yocto Project Reference Distro) SDK installer version 2.0
===============================================================
You are about to install the SDK to "..../toolchain1". Proceed[Y/n]? 
Extracting SDK.....................done
Setting it up....../mastertoolchain/toolchain1/sysroots/x86_64-pokysdk-linux/usr/bin/python: line 4: .../mastertoolchain/toolchain1/sysroots/x86_64-pokysdk-linux/usr/bin/python2.7.real: No such file or directory
SDK could not be set up. Relocate script failed. Abort!
Comment 5 Paul Eggleton 2015-12-02 02:29:03 UTC
Fix merged to master:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=8d784baf25861161a3bdc513e2f5236c0c19710d

I'll send a backport of this to jethro along with a bunch of other backports.
Comment 6 Bogdan Alexandru Voiculescu 2016-01-07 15:22:28 UTC
Verified on master: f8185ff9f8ac697733b41f023cb3a4b98b2f823f

yocto@yocto-PowerEdge-R720:~/yocto/BBB/build/tmp/deploy/sdk$ ./poky-glibc-x86_64-core-image-minimal-armv5e-toolchain-2.0+snapshot.sh -d toolchain1 -y
Poky (Yocto Project Reference Distro) SDK installer version 2.0+snapshot
========================================================================
You are about to install the SDK to "/home/yocto/yocto/BBB/build/tmp/deploy/sdk/toolchain1". Proceed[Y/n]? Y
Extracting SDK.......................done
Setting it up...done
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
 $ . /home/yocto/yocto/BBB/build/tmp/deploy/sdk/toolchain1/environment-setup-armv5e-poky-linux-gnueabi
yocto@yocto-PowerEdge-R720:~/yocto/BBB/build/tmp/deploy/sdk$ source toolchain1/environment-setup-armv5e-poky-linux-gnueabi
yocto@yocto-PowerEdge-R720:~/yocto/BBB/build/tmp/deploy/sdk$ rm -rf toolchain1/*
yocto@yocto-PowerEdge-R720:~/yocto/BBB/build/tmp/deploy/sdk$  ./poky-glibc-x86_64-core-image-minimal-armv5e-toolchain-2.0+snapshot.sh -d toolchain1 -y
Poky (Yocto Project Reference Distro) SDK installer version 2.0+snapshot
========================================================================
You are about to install the SDK to "/home/yocto/yocto/BBB/build/tmp/deploy/sdk/toolchain1". Proceed[Y/n]? Y
Extracting SDK.......................done
Setting it up...done
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
 $ . /home/yocto/yocto/BBB/build/tmp/deploy/sdk/toolchain1/environment-setup-armv5e-poky-linux-gnueabi