<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>15045</bug_id>
          
          <creation_ts>2023-02-24 09:31:07 +0000</creation_ts>
          <short_desc>gcc-cross-canadian-arm fails on rebuild</short_desc>
          <delta_ts>2023-03-17 13:38:25 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>4.2 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ovidiu Panait">ovidiu.panait</reporter>
          <assigned_to name="Unassigned">unassigned</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>95008</commentid>
    <comment_count>0</comment_count>
    <who name="Ovidiu Panait">ovidiu.panait</who>
    <bug_when>2023-02-24 09:31:07 +0000</bug_when>
    <thetext>git clone git://git.yoctoproject.org/poky
cd poky; . oe-init-build-env

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

bitbake gcc-cross-canadian-arm

update local.conf to force a rebuild:
GCCPIE = &quot;--disable-default-pie&quot;

bitbake gcc-cross-canadian-arm

Failure log:
The stack trace of python calls that resulted in this exception/failure was:
File: &apos;exec_func_python() autogenerated&apos;, lineno: 2, function: &lt;module&gt;
     0001:
 *** 0002:extend_recipe_sysroot(d)
     0003:
File: &apos;poky/meta/classes-global/staging.bbclass&apos;, lineno: 614, function: extend_recipe_sysroot
     0610:                    if &quot;/bin/&quot; in l or &quot;/sbin/&quot; 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: &apos;poky/meta/classes-global/staging.bbclass&apos;, 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: &apos;poky/build/tmp/sysroots-components/armv7at2hf-neon/lib32-linux-libc-headers/usr/include/asm/byteorder-32.h&apos; -&gt; &apos;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&apos;

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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95163</commentid>
    <comment_count>1</comment_count>
    <who name="Ovidiu Panait">ovidiu.panait</who>
    <bug_when>2023-03-17 13:38:25 +0000</bug_when>
    <thetext>This was fixed by commits:
https://github.com/openembedded/openembedded-core/commit/891d3faa3ed3d1cc231da58e5fa1325f05d5ade5
https://github.com/openembedded/openembedded-core/commit/beab42e00713880cd95a04729c892f8662fbcbed</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>