Bug 6844

Summary: [multilib] lib32-core-image-minimal's WORKDIR is incorrect
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Hongxu Jia <hongxu.jia>
Component: coreAssignee: Hongxu Jia <hongxu.jia>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: liezhi.yang, mark.hatle, meta.mr.watcher, meta.watcher
Version: 1.8   
Target Milestone: Future   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Hongxu Jia 2014-10-16 06:11:09 UTC
1. env
vim local.conf
...
MACHINE = "qemux86-64"
require conf/multilib.conf
MULTILIBS ?= "multilib:lib32"
DEFAULTTUNE_virtclass-multilib-lib32 ?= "x86"
...

2. build lib32-core-image-minimal and core-image-minimal
$ bitbake lib32-core-image-minimal
$ bitbake core-image-minimal

3. Check both images's WORKDIR, they are located in the same dir
$ ls tmp/work/qemux86_64-poky-linux/ -al
...
drwxrwxr-x  3 jiahongxu jiahongxu 4096 Oct 13 16:01 core-image-minimal
drwxrwxr-x  3 jiahongxu jiahongxu 4096 Oct 16 11:11 lib32-core-image-minimal
...

4.lib32-core-image-minimal's WORKDIR is supposed to be in
  tmp/work/qemux86_64-pokymllib32-linux/
Comment 1 Hongxu Jia 2014-10-16 07:39:27 UTC
The reason is variable TARGET_VENDOR was not override for multilib
in that situation.

Is it necessary to do the multilib expansion on TARGET_VENDOR ? (See
the following patch)

It affected many other variables, such as:
"HOST_VENDOR, STAGING_BINDIR_TOOLCHAIN, TARGET_SYS, MULTIMACH_TARGET_SYS,
REAL_MULTIMACH_TARGET_SYS, SSTATE_PKGSPEC"

If we do the modification, there may be potential issues which were
caused by the above variables.

Any suggestions is welcomed.

//Hongxu
Comment 2 Hongxu Jia 2014-10-16 07:40:00 UTC
While building multilib extended images such as libXX-core-image-minimal,
the WORKDIR has the same dir with the building of core-image-minimal.

$ ls tmp/work/qemux86_64-poky-linux/ -al
...
drwxrwxr-x  3 jiahongxu jiahongxu 4096 Oct 13 16:01 core-image-minimal
drwxrwxr-x  3 jiahongxu jiahongxu 4096 Oct 16 11:11 lib32-core-image-minimal
...

While image class is inherited, it did not assign OVERRIDES with
'virtclass-multilib-libXXX', so the reason is variable TARGET_VENDOR was
not override for multilib in that situation.

It refers what did for PN and MLPREFIX, and manually do the multilib
override for TARGET_VENDOR in RecipePreFinalise handler.

[YOCTO #6844]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/classes/multilib.bbclass | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/classes/multilib.bbclass b/meta/classes/multilib.bbclass
index 6e143dd..2a90d9e 100644
--- a/meta/classes/multilib.bbclass
+++ b/meta/classes/multilib.bbclass
@@ -21,6 +21,9 @@ python multilib_virtclass_handler () {
     if bb.data.inherits_class('image', e.data):
         e.data.setVar("MLPREFIX", variant + "-")
         e.data.setVar("PN", variant + "-" + e.data.getVar("PN", False))
+        target_vendor = e.data.getVar("TARGET_VENDOR_" + "virtclass-multilib-" + variant, False)
+        if target_vendor:
+            e.data.setVar("TARGET_VENDOR", target_vendor)
         return
 
     if bb.data.inherits_class('cross-canadian', e.data):
--
Comment 3 Hongxu Jia 2014-11-05 02:30:10 UTC
Merged into master:

commit facfeb0b4475a88eed2694ee95d570f66ec6601e
Author: Hongxu Jia <hongxu.jia@windriver.com>
Date:   Thu Oct 16 15:16:25 2014 +0800

    multilib.bbclass: fix incorrect TARGET_VENDOR in multilib image
    
    While building multilib extended images such as libXX-core-image-minimal,
    the WORKDIR has the same dir with the building of core-image-minimal.
    
    $ ls tmp/work/qemux86_64-poky-linux/ -al
    ...
    drwxrwxr-x  3 jiahongxu jiahongxu 4096 Oct 13 16:01 core-image-minimal
    drwxrwxr-x  3 jiahongxu jiahongxu 4096 Oct 16 11:11 lib32-core-image-minimal
    ...
    
    While image class is inherited, it did not assign OVERRIDES with
    'virtclass-multilib-libXXX', so the reason is variable TARGET_VENDOR was
    not override for multilib in that situation.
    
    It refers what did for PN and MLPREFIX, and manually do the multilib
    override for TARGET_VENDOR in RecipePreFinalise handler.
    
    [YOCTO #6844]
    
    (From OE-Core rev: 7ca012fb3addb11ba3f899efa0619ddd8d3c6946)