Bug 15045 - gcc-cross-canadian-arm fails on rebuild
Summary: gcc-cross-canadian-arm fails on rebuild
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 4.2 M4
Assignee: Unassigned
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2023-02-24 09:31 UTC by Ovidiu Panait
Modified: 2023-03-17 13:38 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ovidiu Panait 2023-02-24 09:31:07 UTC
git clone git://git.yoctoproject.org/poky
cd poky; . oe-init-build-env

add to local.conf:
require conf/multilib.conf
MACHINE = "qemuarm64"
MULTILIBS = "multilib:lib32"
DEFAULTTUNE:virtclass-multilib-lib32 = "armv7athf-neon"

bitbake gcc-cross-canadian-arm

update local.conf to force a rebuild:
GCCPIE = "--disable-default-pie"

bitbake gcc-cross-canadian-arm

Failure log:
The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:extend_recipe_sysroot(d)
     0003:
File: 'poky/meta/classes-global/staging.bbclass', lineno: 614, function: extend_recipe_sysroot
     0610:                    if "/bin/" in l or "/sbin/" in l:
     0611:                        # defer /*bin/* files until last in case they need libs
     0612:                        binfiles[l] = (targetdir, dest)
     0613:                    else:
 *** 0614:                        staging_copyfile(l, targetdir, dest, postinsts, seendirs)
     0615:
     0616:    # Handle deferred binfiles
     0617:    for l in binfiles:
     0618:        (targetdir, dest) = binfiles[l]
File: 'poky/meta/classes-global/staging.bbclass', lineno: 164, function: staging_copyfile
     0160:        os.symlink(linkto, dest)
     0161:        #bb.warn(c)
     0162:    else:
     0163:        try:
 *** 0164:            os.link(c, dest)
     0165:        except OSError as err:
     0166:            if err.errno == errno.EXDEV:
     0167:                bb.utils.copyfile(c, dest)
     0168:            else:
Exception: FileExistsError: [Errno 17] File exists: 'poky/build/tmp/sysroots-components/armv7at2hf-neon/lib32-linux-libc-headers/usr/include/asm/byteorder-32.h' -> 'poky/build/tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-arm/12.2.0-r0/recipe-sysroot/usr/include/asm/byteorder-32.h'

Analysis:
The manifest files build/tmp/sysroots-components/manifests/lib32-linux-libc-headers.xxx contain lib32-recipe-sysroot paths:
lib32-recipe-sysroot/usr/include/asm/byteorder-32.h
lib32-recipe-sysroot/usr/include/asm/sigcontext-32.h
lib32-recipe-sysroot/usr/include/asm/unistd-oabi.h
lib32-recipe-sysroot/usr/include/asm/unistd-32.h
lib32-recipe-sysroot/usr/include/asm/byteorder.h
lib32-recipe-sysroot/usr/include/asm/hwcap.h
...

but the actual files get copied to recipe-sysroot directory during do_prepare_recipe_sysroot() of gcc-cross-canadian-arm. (for cross-canadian recipes RECIPE_SYSROOT points to recipe-sysroot ([1]) ). 

Because of this mismatch, on rebuild, sstate_clean_manifest() will not clean the files in recipe-sysroot, but will try instead to delete the non-existent files in lib32-recipe-sysroot, which will trigger the FileExistsError afterwards.

[1] https://github.com/openembedded/openembedded-core/commit/ae48ee6627e6c1c4f1fcc4ead40edc968e64f7fe