Bug 11631

Summary: sysroot population needs to give better errors if files already exist
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Ross Burton <ross.burton>
Component: coreAssignee: Ross Burton <ross.burton>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: jon.richardson, juro.bystricky, meta.mr.watcher, meta.watcher, richard.purdie, scott.branden
Version: 2.3   
Target Milestone: 2.4 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Ross Burton 2017-06-07 22:44:23 UTC
If DEPENDS has two recipes that provide the same file, the error isn't obvious:

ERROR: gst-player-0.0.1+gitAUTOINC+ee3c226c82-r0 do_prepare_recipe_sysroot: Function failed: extend_recipe_sysroot
ERROR: Logfile of failure stored in: /data/poky-master/tmp/work/corei7-64-poky-linux/gst-player/0.0.1+gitAUTOINC+ee3c226c82-r0/temp/log.do_prepare_recipe_sysroot.17492
ERROR: gstreamer1.0-vaapi-1.10.4-r0 do_prepare_recipe_sysroot: 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: '/home/ross/Yocto/poky/meta/classes/staging.bbclass', lineno: 592, function: extend_recipe_sysroot
     0588:                    dest = newmanifest[l]
     0589:                    if l.endswith("/"):
     0590:                        staging_copydir(l, targetdir, dest, seendirs)
     0591:                        continue
 *** 0592:                    staging_copyfile(l, targetdir, dest, postinsts, seendirs)
     0593:
     0594:    for f in fixme:
     0595:        if f == '':
     0596:            staging_processfixme(fixme[f], recipesysroot, recipesysroot, recipesysrootnative, d)
File: '/home/ross/Yocto/poky/meta/classes/staging.bbclass', lineno: 233, function: staging_copyfile
     0229:        os.symlink(linkto, dest)
     0230:        #bb.warn(c)
     0231:    else:
     0232:        try:
 *** 0233:            os.link(c, dest)
     0234:        except OSError as err:
     0235:            if err.errno == errno.EXDEV:
     0236:                bb.utils.copyfile(c, dest)
     0237:            else:
Exception: FileExistsError: [Errno 17] File exists: '/data/poky-master/tmp/sysroots-components/corei7-64/gstreamer1.0-plugins-base/usr/lib/gstreamer-1.0/libgstrawparse.so' -> '/data/poky-master/tmp/work/corei7-64-poky-linux/gstreamer1.0-vaapi/1.10.4-r0/recipe-sysroot/usr/lib/gstreamer-1.0/libgstrawparse.so'

If it could just say something like this then it would be a lot nicer:

ERROR: gstreamer1.0-vaapi depends on gstreamer1.0-plugins-base that provides /usr/lib/gstreamer-1.0/libgstrawparse.so but that is already provided by <LOOK THIS UP>
Comment 1 Jonathan Richardson 2017-09-13 17:55:05 UTC
We're seeing this error too but it is caused by something else. If we have a recipe with an intertask dependency on a recipe using a different multilib config we get many instances of errors caused by exceptions thrown in staging.bbclass.

A recipe using aarch64 tuning (not that it matters) depends on do_deploy from a recipe that needs to be built with a multilib config named softfp:
do_compile[depends] += "softfp-brcm-crmu:do_deploy"

ML config defined as:
require conf/multilib.conf
MULTILIB_GLOBAL_VARIANTS += "softfp"
MULTILIBS += "multilib:softfp"
DEFAULTTUNE_virtclass-multilib-softfp = "armv6t"

I caught all the exceptions throwing in staging.bbclass but other errors show up as well later.

ERROR: brcm-atf-gitAUTOINC+e0ccbe65dd-r0 do_install: 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: '/home/pramodku/repos/yocto/12092017/poky/build/../meta/classes/staging.bbclass', lineno: 592, function: extend_recipe_sysroot
     0588:                    dest = newmanifest[l]
     0589:                    if l.endswith("/"):
     0590:                        staging_copydir(l, targetdir, dest, seendirs)
     0591:                        continue
 *** 0592:                    staging_copyfile(l, targetdir, dest, postinsts, seendirs)
     0593:
     0594:    for f in fixme:
     0595:        if f == '':
     0596:            staging_processfixme(fixme[f], recipesysroot, recipesysroot, recipesysrootnative, d)
File: '/home/pramodku/repos/yocto/12092017/poky/build/../meta/classes/staging.bbclass', lineno: 233, function: staging_copyfile
     0229:        os.symlink(linkto, dest)
     0230:        #bb.warn(c)
     0231:    else:
     0232:        try:
 *** 0233:            os.link(c, dest)
     0234:        except OSError as err:
     0235:            if err.errno == errno.EXDEV:
     0236:                bb.utils.copyfile(c, dest)
     0237:            else:
Exception: FileExistsError: [Errno 17] File exists: '/home/pramodku/repos/yocto/12092017/poky/build/tmp/sysroots-components/armv6-vfp/softfp-gcc-runtime/usr/share/gcc-7.1.0/python/libstdcxx/__init__.py' -> '/home/pramodku/repos/yocto/12092017/poky/build/tmp/work/bcm958802a8021-pokymlsoftfp-linux-gnueabi/brcm-atf/gitAUTOINC+e0ccbe65dd-r0/softfp-recipe-sysroot/usr/share/gcc-7.1.0/python/libstdcxx/__init__.py'
Comment 2 Ross Burton 2017-09-13 18:01:32 UTC
Jonathan: current master should be giving you a nice error message now, can you test with that?

(fixed in oe-core 2ebbeb61114e4b847e9164c621ac87b5cf03a299)
Comment 3 Jonathan Richardson 2017-09-13 23:21:15 UTC
Thanks Ross. I noticed we were behind a bit. I don't see a warning but your commit actually fixes the problem.
Comment 4 Jonathan Richardson 2017-09-13 23:28:33 UTC
Actually looking more closely at your fix it should print a warning only. Not sure why I don't see the issue anymore. Maybe it will re-appear, or a different commit fixed it. I'll file a different bug if it comes back.