Bug 8826

Summary: Failed to run devtool for ext_sdk on i686 host
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Yi Zhao <yi.zhao>
Component: devtools / tool chainAssignee: Juro Bystricky <juro.bystricky>
Status: VERIFIED FIXED QA Contact: Yi Zhao <yi.zhao>
Severity: normal    
Priority: Medium+ CC: alexandru.c.georgescu, ke.zou, meta.mr.watcher, meta.watcher, yi.zhao
Version: 2.1   
Target Milestone: 1.4.5   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: New (Never tested)
Verified: Documentation change: No (bug/feature does not impact docs)

Description Yi Zhao 2015-12-17 05:39:18 UTC
Git rev: master/5e3e2e0cbb0a49986f4653e64c4c8d2b5461645e

Build Host: Fedora 23 i686
Test Host: Fedora 23 i686 and Debian 8 i686

Steps:
1. bitbake core-image-sato -c populate_sdk_ext
2. Install the poky-glibc-x86_64-core-image-sato-ppc7400-toolchain-ext-2.0+snapshot.sh and setup the environment
3. Run devtool

Error message:
###########
$ devtool --help
ImportError: No module named site
###########
Comment 1 Paul Eggleton 2015-12-17 10:06:43 UTC
First question - did it actually install successfully?
Comment 2 Yi Zhao 2015-12-18 02:00:52 UTC
(In reply to comment #1)
> First question - did it actually install successfully?

You are right, actually it didn't install successfully. I checked the preparing_build_system.log:

###########################
### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal
    core-image-sato
    meta-toolchain
    adt-installer
    meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86'
Parsing recipes..done.
Created bbappend /buildarea/poky_sdk/workspace/appends/core-image-sato.bbappend
WARNING: Host distribution "Fedora-23" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
Loading cache...done.
Loaded 1311 entries from dependency cache.
Parsing recipes...done.
Parsing of 888 .bb files complete (887 cached, 1 parsed). 1310 targets, 69 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = "1.28.0"
BUILD_SYS         = "i686-linux"
NATIVELSBSTRING   = "SDK-Fixed"
TARGET_SYS        = "mips-poky-linux"
MACHINE           = "qemumips"
DISTRO            = "poky"
DISTRO_VERSION    = "2.0+snapshot-20151216"
TUNE_FEATURES     = "o32 bigendian fpu-hard mips32r2"
TARGET_FPU        = ""
meta    
meta-yocto    
meta-yocto-bsp    
workspace         = "<unknown>:<unknown>"

Traceback (most recent call last):
  File "/buildarea/poky_sdk/tmp/sysroots/relocate_sdk.py", line 218, in <module>
    perms = os.stat(e)[stat.ST_MODE]
OSError: [Errno 2] No such file or directory: '/buildarea/poky_sdk/tmp/sysroots/i686-linux/lib/ld-linux-x86-64.so.2'
('__init__() takes at least 3 arguments (1 given)', <class 'subprocess.CalledProcessError'>, ()) 
Summary: There was 1 WARNING message shown.

#############################
Comment 3 Juro Bystricky 2015-12-18 19:09:04 UTC
Is this a typo?:
poky-glibc-x86_64-core-image-sato-ppc7400-toolchain-ext-2.0+snapshot.sh
On an i686 system I would expect 
poky-glibc-i686-core-image-sato-ppc7400-toolchain-ext-2.0+snapshot.sh
(which I observed on my Fedora23 i686 system).

Anyway, I don't think there is a reason for a 64 bit loader (ld-linux-x86-64.so.2) being present on a 32 bit system, so the loader missing is probably not a bug. (ld-linux.so.2 should be used instead)

I could reproduce the problem with the commit 5e3e2e0cbb0a49986f4653e64c4c8d2b5461645e.

Seems like a relocation error. I will try to reproduce with the current master (and
sprinkle relocate_sdk.py with some debug messages.)
Comment 4 Juro Bystricky 2015-12-18 23:28:59 UTC
So using the master (f1f3716776078d68bd9e3734bca881a486dc2ea3) and 

$ bitbake core-image-minimal -c populate_sdk_ext

I successfully installed:

$ ./poky-glibc-i686-core-image-minimal-i586-toolchain-ext-2.0+snapshot.sh

There were no problems, and also relocate_sdk.py output shows the passed arguments (I added some printouts):

new_prefix = /home/juro/poky-sdk3/tmp/sysroots/i686-linux
new_dl_path = /home/juro/poky-sdk3/tmp/sysroots/i686-linux/lib/ld-linux.so.2
exec_list: ['/home/juro/poky-sdk3/tmp/sysroots/i686-linux/lib/ld-linux.so.2', '/home/juro/poky-sdk3/tmp/sysroots/i686-linux/usr/bin/patchelf-uninative']

and also 

$ devtool --help

behaves correctly.

I will still re-run these tests with the original problem settings (core-image-sato, qemuppc).
Comment 5 Juro Bystricky 2015-12-18 23:42:49 UTC
I believe the problem was fixed by the commit:

a5dd1dd8904c62ef0ca5c208f997453e77860add

uninative.bbclass: Choose the correct loader based on BUILD_ARCH
Comment 6 Juro Bystricky 2015-12-18 23:48:37 UTC
The issue has been fixed and is explained, so I'm closing this bug report.
Comment 7 Yi Zhao 2016-02-03 07:17:22 UTC
Verified with 2.1_M2 (master/3d2c0f5902cacf9d8544bf263b51ef0dd1a7218c)