Bug 11042

Summary: Fail to build sdk_ext if enable 'rm_work'
Product: [Yocto Project Subprojects] eSDK Reporter: Yi Zhao <yi.zhao>
Component: eSDKAssignee: Richard Purdie <richard.purdie>
Status: VERIFIED FIXED QA Contact: Francisco Pedraza <francisco.j.pedraza.gonzalez>
Severity: normal    
Priority: Medium+ CC: jose.perez.carranza, patrick.ohly, yi.zhao
Version: 2.3   
Target Milestone: 2.3 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: Regression (Used to work)
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
log.do_sdk_depends none

Description Yi Zhao 2017-02-10 03:06:27 UTC
Created attachment 3630 [details]
log.do_sdk_depends

Git rev: master/e758547db9048d4aa1c1415d6af8072f519fae24

Steps:
1. Download the poky source and set the environment
2. Add INHERIT += "rm_work" in confi/local.conf
3. Run "bitbake core-image-sato -c populate_sdk_ext"

Error message:
##############################
bitbake core-image-sato -c populate_sdk_ext
Parsing recipes: 100% |################################################################################################################################| Time: 0:00:28
Parsing of 856 .bb files complete (0 cached, 856 parsed). 1321 targets, 53 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = "1.33.1"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "ubuntu-16.04"
TARGET_SYS        = "i586-poky-linux"
MACHINE           = "qemux86"
DISTRO            = "poky"
DISTRO_VERSION    = "2.2+snapshot-20170210"
TUNE_FEATURES     = "m32 i586"
TARGET_FPU        = ""
meta              
meta-poky         
meta-yocto-bsp    = "master:e758547db9048d4aa1c1415d6af8072f519fae24"

Initialising tasks: 100% |#############################################################################################################################| Time: 0:00:14
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: core-image-sato-1.0-r0 do_rm_work: Function failed: do_rm_work (log file is located at /buildarea1/build/tmp/work/qemux86-poky-linux/core-image-sato/1.0-r0/temp/log.do_rm_work.15907)
ERROR: Logfile of failure stored in: /buildarea1/build/tmp/work/qemux86-poky-linux/core-image-sato/1.0-r0/temp/log.do_rm_work.15907
Log data follows:
| DEBUG: Executing shell function do_rm_work
| rm: cannot remove 'recipe-sysroot/usr/share/icons/Adwaita/256x256/actions': Directory not empty
| WARNING: /buildarea1/build/tmp/work/qemux86-poky-linux/core-image-sato/1.0-r0/temp/run.do_rm_work.15907:1 exit 1 from 'rm -rf $dir'
| ERROR: Function failed: do_rm_work (log file is located at /buildarea1/build/tmp/work/qemux86-poky-linux/core-image-sato/1.0-r0/temp/log.do_rm_work.15907)
ERROR: Task (/buildarea1/poky/meta/recipes-sato/images/core-image-sato.bb:do_rm_work) failed with exit code '1'
ERROR: core-image-sato-1.0-r0 do_sdk_depends: Error executing a python function in exec_python_func() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:extend_recipe_sysroot(d)
     0003:
File: '/buildarea1/poky/meta/classes/staging.bbclass', lineno: 623, function: extend_recipe_sysroot
     0619:                    dest = newmanifest[l]
     0620:                    if l.endswith("/"):
     0621:                        staging_copydir(l, targetdir, dest, seendirs)
     0622:                        continue
 *** 0623:                    staging_copyfile(l, targetdir, dest, postinsts, seendirs)
     0624:
     0625:    for f in fixme:
     0626:        if f == '':
     0627:            staging_processfixme(fixme[f], recipesysroot, recipesysroot, recipesysrootnative, d)
File: '/buildarea1/poky/meta/classes/staging.bbclass', lineno: 269, function: staging_copyfile
     0265:        os.symlink(linkto, dest)
     0266:        #bb.warn(c)
     0267:    else:
     0268:        try:
 *** 0269:            os.link(c, dest)
     0270:        except OSError as err:
     0271:            if err.errno == errno.EXDEV:
     0272:                bb.utils.copyfile(c, dest)
     0273:            else:
Exception: FileNotFoundError: [Errno 2] No such file or directory: '/buildarea1/build/tmp/sysroots-components/all/adwaita-icon-theme/sysroot-providers/adwaita-icon-theme' -> '/buildarea1/build/tmp/work/qemux86-poky-linux/core-image-sato/1.0-r0/recipe-sysroot/sysroot-providers/adwaita-icon-theme'

ERROR: core-image-sato-1.0-r0 do_sdk_depends: Function failed: extend_recipe_sysroot
ERROR: Logfile of failure stored in: /buildarea1/build/tmp/work/qemux86-poky-linux/core-image-sato/1.0-r0/temp/log.do_sdk_depends.15000
ERROR: Task (/buildarea1/poky/meta/recipes-sato/images/core-image-sato.bb:do_sdk_depends) failed with exit code '1'
NOTE: Tasks Summary: Attempted 6790 tasks of which 6 didn't need to be rerun and 2 failed.

Summary: 2 tasks failed:
  /buildarea1/poky/meta/recipes-sato/images/core-image-sato.bb:do_rm_work
  /buildarea1/poky/meta/recipes-sato/images/core-image-sato.bb:do_sdk_depends
Summary: There were 3 ERROR messages shown, returning a non-zero exit code.
#####################################################

The full log is attached.
Comment 1 Richard Purdie 2017-03-29 08:27:04 UTC
The issue here is that do_populate_sdk_ext is a floating task, it doesn't have to happen before do_build. do_rm_work happens before do_build, so it can execute in parallel with other tasks like do_populate_sdk_ext or do_sdk_depends. Not sure how to fix that as yet...
Comment 2 Patrick Ohly 2017-03-29 11:30:59 UTC
I've posted a possible solution as "eSDK: enhance compatibility with rm_work".
Comment 4 Yi Zhao 2017-04-10 01:23:21 UTC
Verified with master/633ad6c9f436f5d2b6ee1a005b697661a054a394