All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] sstate.bbclass: factor out manifest cleanup code from sstate_clean_manifest()
@ 2023-02-27 15:42 Ovidiu Panait
  2023-02-27 15:42 ` [PATCH 2/2] sstate.bbclass: fix cleanup when sysroot in manifest != RECIPE_SYSROOT Ovidiu Panait
  0 siblings, 1 reply; 10+ messages in thread
From: Ovidiu Panait @ 2023-02-27 15:42 UTC (permalink / raw)
  To: openembedded-core

Move manifest entry cleanup code from sstate_clean_manifest() to its own
function, so it can be reused.

Signed-off-by: Ovidiu Panait <ovidiu.panait@eng.windriver.com>
---
 meta/classes-global/sstate.bbclass | 40 ++++++++++++++++--------------
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass
index 567de4aba4..af93546b04 100644
--- a/meta/classes-global/sstate.bbclass
+++ b/meta/classes-global/sstate.bbclass
@@ -501,6 +501,27 @@ def sstate_clean_cachefiles(d):
         ss = sstate_state_fromvars(ld, task)
         sstate_clean_cachefile(ss, ld)
 
+def sstate_clean_entry(entry, canrace, prefix):
+    entry = entry.strip()
+    if prefix and not entry.startswith("/"):
+        entry = prefix + "/" + entry
+
+    bb.debug(2, "Removing manifest: %s" % entry)
+    # We can race against another package populating directories as we're removing them
+    # so we ignore errors here.
+    try:
+        if entry.endswith("/"):
+            if os.path.islink(entry[:-1]):
+                os.remove(entry[:-1])
+            elif os.path.exists(entry) and len(os.listdir(entry)) == 0 and not canrace:
+                # Removing directories whilst builds are in progress exposes a race. Only
+                # do it in contexts where it is safe to do so.
+                os.rmdir(entry[:-1])
+        else:
+            os.remove(entry)
+    except OSError:
+        pass
+
 def sstate_clean_manifest(manifest, d, canrace=False, prefix=None):
     import oe.path
 
@@ -509,24 +530,7 @@ def sstate_clean_manifest(manifest, d, canrace=False, prefix=None):
     mfile.close()
 
     for entry in entries:
-        entry = entry.strip()
-        if prefix and not entry.startswith("/"):
-            entry = prefix + "/" + entry
-        bb.debug(2, "Removing manifest: %s" % entry)
-        # We can race against another package populating directories as we're removing them
-        # so we ignore errors here.
-        try:
-            if entry.endswith("/"):
-                if os.path.islink(entry[:-1]):
-                    os.remove(entry[:-1])
-                elif os.path.exists(entry) and len(os.listdir(entry)) == 0 and not canrace:
-                    # Removing directories whilst builds are in progress exposes a race. Only
-                    # do it in contexts where it is safe to do so.
-                    os.rmdir(entry[:-1])
-            else:
-                os.remove(entry)
-        except OSError:
-            pass
+        sstate_clean_entry(entry, canrace, prefix)
 
     postrm = manifest + ".postrm"
     if os.path.exists(manifest + ".postrm"):
-- 
2.39.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] sstate.bbclass: fix cleanup when sysroot in manifest != RECIPE_SYSROOT
  2023-02-27 15:42 [PATCH 1/2] sstate.bbclass: factor out manifest cleanup code from sstate_clean_manifest() Ovidiu Panait
@ 2023-02-27 15:42 ` Ovidiu Panait
  2023-02-27 15:56   ` [OE-core] " Richard Purdie
  2023-03-06 17:59   ` Richard Purdie
  0 siblings, 2 replies; 10+ messages in thread
From: Ovidiu Panait @ 2023-02-27 15:42 UTC (permalink / raw)
  To: openembedded-core

The following scenario currently fails:
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: 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'

In this particular case, the paths in lib32-linux-libc-headers manifest file
are prefixed with lib32-recipe-sysroot:
$ cat build/tmp/sysroots-components/manifests/lib32-linux-libc-headers.xxx
lib32-recipe-sysroot/usr/include/asm/byteorder-32.h
lib32-recipe-sysroot/usr/include/asm/sigcontext-32.h
...

When gcc-cross-canadian-arm is built, the actual files get copied to
recipe-sysroot directory during do_prepare_recipe_sysroot().

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

Add checks in sstate_clean_manifest() for this corner case, so that
RECIPE_SYSROOT gets cleaned up properly.

This fixes BZ#15045.

Signed-off-by: Ovidiu Panait <ovidiu.panait@eng.windriver.com>
---
 meta/classes-global/sstate.bbclass | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass
index af93546b04..edf5c7fb65 100644
--- a/meta/classes-global/sstate.bbclass
+++ b/meta/classes-global/sstate.bbclass
@@ -529,9 +529,20 @@ def sstate_clean_manifest(manifest, d, canrace=False, prefix=None):
     entries = mfile.readlines()
     mfile.close()
 
+    recipe_sysroot = d.getVar("RECIPE_SYSROOT").rstrip("/").rsplit('/', 1)[-1]
+
     for entry in entries:
         sstate_clean_entry(entry, canrace, prefix)
 
+        # The sysroot directory stored in the manifest file might not be the
+        # same as RECIPE_SYSROOT, so the real sysroot will not be properly
+        # cleaned up on rebuild. Handle the cleanup here in order to avoid
+        # "File exists" errors during do_prepare_recipe_sysroot().
+        manifest_sysroot = entry.split("/", 1)[0] or None
+        if manifest_sysroot and manifest_sysroot != recipe_sysroot and not manifest_sysroot.endswith("-native"):
+            sysroot_entry = recipe_sysroot + "/" + entry.split("/", 1)[1]
+            sstate_clean_entry(sysroot_entry, canrace, prefix)
+
     postrm = manifest + ".postrm"
     if os.path.exists(manifest + ".postrm"):
         import subprocess
-- 
2.39.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [OE-core] [PATCH 2/2] sstate.bbclass: fix cleanup when sysroot in manifest != RECIPE_SYSROOT
  2023-02-27 15:42 ` [PATCH 2/2] sstate.bbclass: fix cleanup when sysroot in manifest != RECIPE_SYSROOT Ovidiu Panait
@ 2023-02-27 15:56   ` Richard Purdie
  2023-02-27 17:17     ` Ovidiu Panait
  2023-03-06 17:59   ` Richard Purdie
  1 sibling, 1 reply; 10+ messages in thread
From: Richard Purdie @ 2023-02-27 15:56 UTC (permalink / raw)
  To: Ovidiu Panait, openembedded-core

On Mon, 2023-02-27 at 17:42 +0200, Ovidiu Panait wrote:
> The following scenario currently fails:
> 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: 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'
> 
> In this particular case, the paths in lib32-linux-libc-headers manifest file
> are prefixed with lib32-recipe-sysroot:
> $ cat build/tmp/sysroots-components/manifests/lib32-linux-libc-headers.xxx
> lib32-recipe-sysroot/usr/include/asm/byteorder-32.h
> lib32-recipe-sysroot/usr/include/asm/sigcontext-32.h
> ...
> 
> When gcc-cross-canadian-arm is built, the actual files get copied to
> recipe-sysroot directory during do_prepare_recipe_sysroot().
> 
> Because of this mismatch, on rebuild, sstate_clean_manifest() will not clean
> the files in recipe-sysroot, but will instead try to delete the non-existent
> files in lib32-recipe-sysroot. This will trigger the FileExists errors later.
> 
> Add checks in sstate_clean_manifest() for this corner case, so that
> RECIPE_SYSROOT gets cleaned up properly.
> 
> This fixes BZ#15045.
> 
> Signed-off-by: Ovidiu Panait <ovidiu.panait@eng.windriver.com>
> ---
>  meta/classes-global/sstate.bbclass | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass
> index af93546b04..edf5c7fb65 100644
> --- a/meta/classes-global/sstate.bbclass
> +++ b/meta/classes-global/sstate.bbclass
> @@ -529,9 +529,20 @@ def sstate_clean_manifest(manifest, d, canrace=False, prefix=None):
>      entries = mfile.readlines()
>      mfile.close()
>  
> +    recipe_sysroot = d.getVar("RECIPE_SYSROOT").rstrip("/").rsplit('/', 1)[-1]
> +
>      for entry in entries:
>          sstate_clean_entry(entry, canrace, prefix)
>  
> +        # The sysroot directory stored in the manifest file might not be the
> +        # same as RECIPE_SYSROOT, so the real sysroot will not be properly
> +        # cleaned up on rebuild. Handle the cleanup here in order to avoid
> +        # "File exists" errors during do_prepare_recipe_sysroot().
> +        manifest_sysroot = entry.split("/", 1)[0] or None
> +        if manifest_sysroot and manifest_sysroot != recipe_sysroot and not manifest_sysroot.endswith("-native"):
> +            sysroot_entry = recipe_sysroot + "/" + entry.split("/", 1)[1]
> +            sstate_clean_entry(sysroot_entry, canrace, prefix)
> +
>      postrm = manifest + ".postrm"
>      if os.path.exists(manifest + ".postrm"):
>          import subprocess

How many recipe-sysroots are there for gcc-cross-canadian-arm ? This
feels like a workaround for some other issue which should probably be
fixed properly instead?

Cheers,

Richard




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [OE-core] [PATCH 2/2] sstate.bbclass: fix cleanup when sysroot in manifest != RECIPE_SYSROOT
  2023-02-27 15:56   ` [OE-core] " Richard Purdie
@ 2023-02-27 17:17     ` Ovidiu Panait
  0 siblings, 0 replies; 10+ messages in thread
From: Ovidiu Panait @ 2023-02-27 17:17 UTC (permalink / raw)
  To: openembedded-core

Hi Richard,

On 2/27/23 17:56, Richard Purdie wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Mon, 2023-02-27 at 17:42 +0200, Ovidiu Panait wrote:
>> The following scenario currently fails:
>> 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: 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'
>>
>> In this particular case, the paths in lib32-linux-libc-headers manifest file
>> are prefixed with lib32-recipe-sysroot:
>> $ cat build/tmp/sysroots-components/manifests/lib32-linux-libc-headers.xxx
>> lib32-recipe-sysroot/usr/include/asm/byteorder-32.h
>> lib32-recipe-sysroot/usr/include/asm/sigcontext-32.h
>> ...
>>
>> When gcc-cross-canadian-arm is built, the actual files get copied to
>> recipe-sysroot directory during do_prepare_recipe_sysroot().
>>
>> Because of this mismatch, on rebuild, sstate_clean_manifest() will not clean
>> the files in recipe-sysroot, but will instead try to delete the non-existent
>> files in lib32-recipe-sysroot. This will trigger the FileExists errors later.
>>
>> Add checks in sstate_clean_manifest() for this corner case, so that
>> RECIPE_SYSROOT gets cleaned up properly.
>>
>> This fixes BZ#15045.
>>
>> Signed-off-by: Ovidiu Panait <ovidiu.panait@eng.windriver.com>
>> ---
>>   meta/classes-global/sstate.bbclass | 11 +++++++++++
>>   1 file changed, 11 insertions(+)
>>
>> diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass
>> index af93546b04..edf5c7fb65 100644
>> --- a/meta/classes-global/sstate.bbclass
>> +++ b/meta/classes-global/sstate.bbclass
>> @@ -529,9 +529,20 @@ def sstate_clean_manifest(manifest, d, canrace=False, prefix=None):
>>       entries = mfile.readlines()
>>       mfile.close()
>>
>> +    recipe_sysroot = d.getVar("RECIPE_SYSROOT").rstrip("/").rsplit('/', 1)[-1]
>> +
>>       for entry in entries:
>>           sstate_clean_entry(entry, canrace, prefix)
>>
>> +        # The sysroot directory stored in the manifest file might not be the
>> +        # same as RECIPE_SYSROOT, so the real sysroot will not be properly
>> +        # cleaned up on rebuild. Handle the cleanup here in order to avoid
>> +        # "File exists" errors during do_prepare_recipe_sysroot().
>> +        manifest_sysroot = entry.split("/", 1)[0] or None
>> +        if manifest_sysroot and manifest_sysroot != recipe_sysroot and not manifest_sysroot.endswith("-native"):
>> +            sysroot_entry = recipe_sysroot + "/" + entry.split("/", 1)[1]
>> +            sstate_clean_entry(sysroot_entry, canrace, prefix)
>> +
>>       postrm = manifest + ".postrm"
>>       if os.path.exists(manifest + ".postrm"):
>>           import subprocess
> How many recipe-sysroots are there for gcc-cross-canadian-arm ? This
> feels like a workaround for some other issue which should probably be
> fixed properly instead?
(resending, as the first reply didn't actually made it to the list)

There are "recipe-sysroot" and "recipe-sysroot-native" sysroots in 
gcc-cross-canadian-arm WORKDIR, but no lib32-recipe-sysroot.


Ovidiu
> Cheers,
>
> Richard
>
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [OE-core] [PATCH 2/2] sstate.bbclass: fix cleanup when sysroot in manifest != RECIPE_SYSROOT
  2023-02-27 15:42 ` [PATCH 2/2] sstate.bbclass: fix cleanup when sysroot in manifest != RECIPE_SYSROOT Ovidiu Panait
  2023-02-27 15:56   ` [OE-core] " Richard Purdie
@ 2023-03-06 17:59   ` Richard Purdie
  2023-03-07 19:04     ` Ovidiu Panait
  1 sibling, 1 reply; 10+ messages in thread
From: Richard Purdie @ 2023-03-06 17:59 UTC (permalink / raw)
  To: Ovidiu Panait, openembedded-core

On Mon, 2023-02-27 at 17:42 +0200, Ovidiu Panait wrote:
> The following scenario currently fails:
> 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: 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'
> 
> In this particular case, the paths in lib32-linux-libc-headers manifest file
> are prefixed with lib32-recipe-sysroot:
> $ cat build/tmp/sysroots-components/manifests/lib32-linux-libc-headers.xxx
> lib32-recipe-sysroot/usr/include/asm/byteorder-32.h
> lib32-recipe-sysroot/usr/include/asm/sigcontext-32.h
> ...
> 
> When gcc-cross-canadian-arm is built, the actual files get copied to
> recipe-sysroot directory during do_prepare_recipe_sysroot().
> 
> Because of this mismatch, on rebuild, sstate_clean_manifest() will not clean
> the files in recipe-sysroot, but will instead try to delete the non-existent
> files in lib32-recipe-sysroot. This will trigger the FileExists errors later.
> 
> Add checks in sstate_clean_manifest() for this corner case, so that
> RECIPE_SYSROOT gets cleaned up properly.
> 
> This fixes BZ#15045.
> 
> Signed-off-by: Ovidiu Panait <ovidiu.panait@eng.windriver.com>
> ---
>  meta/classes-global/sstate.bbclass | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass
> index af93546b04..edf5c7fb65 100644
> --- a/meta/classes-global/sstate.bbclass
> +++ b/meta/classes-global/sstate.bbclass
> @@ -529,9 +529,20 @@ def sstate_clean_manifest(manifest, d, canrace=False, prefix=None):
>      entries = mfile.readlines()
>      mfile.close()
>  
> +    recipe_sysroot = d.getVar("RECIPE_SYSROOT").rstrip("/").rsplit('/', 1)[-1]
> +
>      for entry in entries:
>          sstate_clean_entry(entry, canrace, prefix)
>  
> +        # The sysroot directory stored in the manifest file might not be the
> +        # same as RECIPE_SYSROOT, so the real sysroot will not be properly
> +        # cleaned up on rebuild. Handle the cleanup here in order to avoid
> +        # "File exists" errors during do_prepare_recipe_sysroot().
> +        manifest_sysroot = entry.split("/", 1)[0] or None
> +        if manifest_sysroot and manifest_sysroot != recipe_sysroot and not manifest_sysroot.endswith("-native"):
> +            sysroot_entry = recipe_sysroot + "/" + entry.split("/", 1)[1]
> +            sstate_clean_entry(sysroot_entry, canrace, prefix)
> +
>      postrm = manifest + ".postrm"
>      if os.path.exists(manifest + ".postrm"):
>          import subprocess

I looked into this and as I suspected, the bug is elsewhere. I've sent
a different patch to the staging.bbclass code which should fix this
problem.

Cheers,

Richard




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [OE-core] [PATCH 2/2] sstate.bbclass: fix cleanup when sysroot in manifest != RECIPE_SYSROOT
  2023-03-06 17:59   ` Richard Purdie
@ 2023-03-07 19:04     ` Ovidiu Panait
  2023-03-07 20:45       ` Richard Purdie
  0 siblings, 1 reply; 10+ messages in thread
From: Ovidiu Panait @ 2023-03-07 19:04 UTC (permalink / raw)
  To: Richard Purdie, Ovidiu Panait, openembedded-core

Hi Richard,

On 3/6/23 19:59, Richard Purdie wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Mon, 2023-02-27 at 17:42 +0200, Ovidiu Panait wrote:
>> The following scenario currently fails:
>> 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: 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'
>>
>> In this particular case, the paths in lib32-linux-libc-headers manifest file
>> are prefixed with lib32-recipe-sysroot:
>> $ cat build/tmp/sysroots-components/manifests/lib32-linux-libc-headers.xxx
>> lib32-recipe-sysroot/usr/include/asm/byteorder-32.h
>> lib32-recipe-sysroot/usr/include/asm/sigcontext-32.h
>> ...
>>
>> When gcc-cross-canadian-arm is built, the actual files get copied to
>> recipe-sysroot directory during do_prepare_recipe_sysroot().
>>
>> Because of this mismatch, on rebuild, sstate_clean_manifest() will not clean
>> the files in recipe-sysroot, but will instead try to delete the non-existent
>> files in lib32-recipe-sysroot. This will trigger the FileExists errors later.
>>
>> Add checks in sstate_clean_manifest() for this corner case, so that
>> RECIPE_SYSROOT gets cleaned up properly.
>>
>> This fixes BZ#15045.
>>
>> Signed-off-by: Ovidiu Panait <ovidiu.panait@eng.windriver.com>
>> ---
>>   meta/classes-global/sstate.bbclass | 11 +++++++++++
>>   1 file changed, 11 insertions(+)
>>
>> diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass
>> index af93546b04..edf5c7fb65 100644
>> --- a/meta/classes-global/sstate.bbclass
>> +++ b/meta/classes-global/sstate.bbclass
>> @@ -529,9 +529,20 @@ def sstate_clean_manifest(manifest, d, canrace=False, prefix=None):
>>       entries = mfile.readlines()
>>       mfile.close()
>>
>> +    recipe_sysroot = d.getVar("RECIPE_SYSROOT").rstrip("/").rsplit('/', 1)[-1]
>> +
>>       for entry in entries:
>>           sstate_clean_entry(entry, canrace, prefix)
>>
>> +        # The sysroot directory stored in the manifest file might not be the
>> +        # same as RECIPE_SYSROOT, so the real sysroot will not be properly
>> +        # cleaned up on rebuild. Handle the cleanup here in order to avoid
>> +        # "File exists" errors during do_prepare_recipe_sysroot().
>> +        manifest_sysroot = entry.split("/", 1)[0] or None
>> +        if manifest_sysroot and manifest_sysroot != recipe_sysroot and not manifest_sysroot.endswith("-native"):
>> +            sysroot_entry = recipe_sysroot + "/" + entry.split("/", 1)[1]
>> +            sstate_clean_entry(sysroot_entry, canrace, prefix)
>> +
>>       postrm = manifest + ".postrm"
>>       if os.path.exists(manifest + ".postrm"):
>>           import subprocess
> I looked into this and as I suspected, the bug is elsewhere. I've sent
> a different patch to the staging.bbclass code which should fix this
> problem.

I tested with latest poky sources (with commit "staging: Separate out 
different multiconfig manifests" present), but the same error is still 
triggered on rebuild:

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'

The manifest files still show lib32-recipe-sysroot instead of 
recipe-sysroot (the manifest file seems to have already been cached by 
lib32-gcc-cross-arm):
$ head -2 
tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-arm/12.2.0-r0/recipe-sysroot-native/installeddeps/lib32-linux-libc-headers
lib32-recipe-sysroot/usr/include/asm/byteorder-32.h
lib32-recipe-sysroot/usr/include/asm/sigcontext-32.h

MLPREFIX is set to lib32- for gcc-cross-canadian-arm, so the existing 
manifest file with lib32-recipe-sysroot paths is used:
$ bitbake -e gcc-cross-canadian-arm | grep ^MLPREFIX
MLPREFIX="lib32-"

Adding an exception for cross-canadian to the the mlprefix code added 
earlier seems to make it work:

diff --git a/meta/classes-global/staging.bbclass 
b/meta/classes-global/staging.bbclass
index e6d0d1d55c..a9142ce780 100644
--- a/meta/classes-global/staging.bbclass
+++ b/meta/classes-global/staging.bbclass
@@ -276,6 +276,10 @@ python extend_recipe_sysroot() {
      stagingdir = d.getVar("STAGING_DIR")
      sharedmanifests = d.getVar("COMPONENTS_DIR") + "/manifests"
      mlprefix = d.getVar("MLPREFIX")
+    if "-cross-canadian" in pn:
+        mlprefix = "nativesdk-"
      if mlprefix:
          sharedmanifests = sharedmanifests + "/" + mlprefix
      recipesysroot = d.getVar("RECIPE_SYSROOT")

Ovidiu

> Cheers,
>
> Richard
>
>


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [OE-core] [PATCH 2/2] sstate.bbclass: fix cleanup when sysroot in manifest != RECIPE_SYSROOT
  2023-03-07 19:04     ` Ovidiu Panait
@ 2023-03-07 20:45       ` Richard Purdie
  2023-03-08  6:52         ` Ovidiu Panait
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Purdie @ 2023-03-07 20:45 UTC (permalink / raw)
  To: Ovidiu Panait, Ovidiu Panait, openembedded-core

On Tue, 2023-03-07 at 21:04 +0200, Ovidiu Panait wrote:
> Hi Richard,
> 
> On 3/6/23 19:59, Richard Purdie wrote:
> > CAUTION: This email comes from a non Wind River email account!
> > Do not click links or open attachments unless you recognize the sender and know the content is safe.
> > 
> > On Mon, 2023-02-27 at 17:42 +0200, Ovidiu Panait wrote:
> > > The following scenario currently fails:
> > > 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: 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'
> > > 
> > > In this particular case, the paths in lib32-linux-libc-headers manifest file
> > > are prefixed with lib32-recipe-sysroot:
> > > $ cat build/tmp/sysroots-components/manifests/lib32-linux-libc-headers.xxx
> > > lib32-recipe-sysroot/usr/include/asm/byteorder-32.h
> > > lib32-recipe-sysroot/usr/include/asm/sigcontext-32.h
> > > ...
> > > 
> > > When gcc-cross-canadian-arm is built, the actual files get copied to
> > > recipe-sysroot directory during do_prepare_recipe_sysroot().
> > > 
> > > Because of this mismatch, on rebuild, sstate_clean_manifest() will not clean
> > > the files in recipe-sysroot, but will instead try to delete the non-existent
> > > files in lib32-recipe-sysroot. This will trigger the FileExists errors later.
> > > 
> > > Add checks in sstate_clean_manifest() for this corner case, so that
> > > RECIPE_SYSROOT gets cleaned up properly.
> > > 
> > > This fixes BZ#15045.
> > > 
> > > Signed-off-by: Ovidiu Panait <ovidiu.panait@eng.windriver.com>
> > > ---
> > >   meta/classes-global/sstate.bbclass | 11 +++++++++++
> > >   1 file changed, 11 insertions(+)
> > > 
> > > diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass
> > > index af93546b04..edf5c7fb65 100644
> > > --- a/meta/classes-global/sstate.bbclass
> > > +++ b/meta/classes-global/sstate.bbclass
> > > @@ -529,9 +529,20 @@ def sstate_clean_manifest(manifest, d, canrace=False, prefix=None):
> > >       entries = mfile.readlines()
> > >       mfile.close()
> > > 
> > > +    recipe_sysroot = d.getVar("RECIPE_SYSROOT").rstrip("/").rsplit('/', 1)[-1]
> > > +
> > >       for entry in entries:
> > >           sstate_clean_entry(entry, canrace, prefix)
> > > 
> > > +        # The sysroot directory stored in the manifest file might not be the
> > > +        # same as RECIPE_SYSROOT, so the real sysroot will not be properly
> > > +        # cleaned up on rebuild. Handle the cleanup here in order to avoid
> > > +        # "File exists" errors during do_prepare_recipe_sysroot().
> > > +        manifest_sysroot = entry.split("/", 1)[0] or None
> > > +        if manifest_sysroot and manifest_sysroot != recipe_sysroot and not manifest_sysroot.endswith("-native"):
> > > +            sysroot_entry = recipe_sysroot + "/" + entry.split("/", 1)[1]
> > > +            sstate_clean_entry(sysroot_entry, canrace, prefix)
> > > +
> > >       postrm = manifest + ".postrm"
> > >       if os.path.exists(manifest + ".postrm"):
> > >           import subprocess
> > I looked into this and as I suspected, the bug is elsewhere. I've sent
> > a different patch to the staging.bbclass code which should fix this
> > problem.
> 
> I tested with latest poky sources (with commit "staging: Separate out 
> different multiconfig manifests" present), but the same error is still 
> triggered on rebuild:
> 
> 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'
> 
> The manifest files still show lib32-recipe-sysroot instead of 
> recipe-sysroot (the manifest file seems to have already been cached by 
> lib32-gcc-cross-arm):
> $ head -2 
> tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-arm/12.2.0-r0/recipe-sysroot-native/installeddeps/lib32-linux-libc-headers
> lib32-recipe-sysroot/usr/include/asm/byteorder-32.h
> lib32-recipe-sysroot/usr/include/asm/sigcontext-32.h
> 
> MLPREFIX is set to lib32- for gcc-cross-canadian-arm, so the existing 
> manifest file with lib32-recipe-sysroot paths is used:
> $ bitbake -e gcc-cross-canadian-arm | grep ^MLPREFIX
> MLPREFIX="lib32-"
> 
> Adding an exception for cross-canadian to the the mlprefix code added 
> earlier seems to make it work:
> 
> diff --git a/meta/classes-global/staging.bbclass 
> b/meta/classes-global/staging.bbclass
> index e6d0d1d55c..a9142ce780 100644
> --- a/meta/classes-global/staging.bbclass
> +++ b/meta/classes-global/staging.bbclass
> @@ -276,6 +276,10 @@ python extend_recipe_sysroot() {
>       stagingdir = d.getVar("STAGING_DIR")
>       sharedmanifests = d.getVar("COMPONENTS_DIR") + "/manifests"
>       mlprefix = d.getVar("MLPREFIX")
> +    if "-cross-canadian" in pn:
> +        mlprefix = "nativesdk-"
>       if mlprefix:
>           sharedmanifests = sharedmanifests + "/" + mlprefix
>       recipesysroot = d.getVar("RECIPE_SYSROOT")

Was this in a clean build? The change will need a clean TMPDIR to
properly take effect. I didn't force everyone to rebuild since the
issue is reported so rarely and has been present for a long time.

Cheers,

Richard




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [OE-core] [PATCH 2/2] sstate.bbclass: fix cleanup when sysroot in manifest != RECIPE_SYSROOT
  2023-03-07 20:45       ` Richard Purdie
@ 2023-03-08  6:52         ` Ovidiu Panait
  2023-03-08 10:18           ` Richard Purdie
  0 siblings, 1 reply; 10+ messages in thread
From: Ovidiu Panait @ 2023-03-08  6:52 UTC (permalink / raw)
  To: Richard Purdie, Ovidiu Panait, openembedded-core

Hi Richard,

On 3/7/23 22:45, Richard Purdie wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Tue, 2023-03-07 at 21:04 +0200, Ovidiu Panait wrote:
>> Hi Richard,
>>
>> On 3/6/23 19:59, Richard Purdie wrote:
>>> CAUTION: This email comes from a non Wind River email account!
>>> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>>>
>>> On Mon, 2023-02-27 at 17:42 +0200, Ovidiu Panait wrote:
>>>> The following scenario currently fails:
>>>> 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: 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'
>>>>
>>>> In this particular case, the paths in lib32-linux-libc-headers manifest file
>>>> are prefixed with lib32-recipe-sysroot:
>>>> $ cat build/tmp/sysroots-components/manifests/lib32-linux-libc-headers.xxx
>>>> lib32-recipe-sysroot/usr/include/asm/byteorder-32.h
>>>> lib32-recipe-sysroot/usr/include/asm/sigcontext-32.h
>>>> ...
>>>>
>>>> When gcc-cross-canadian-arm is built, the actual files get copied to
>>>> recipe-sysroot directory during do_prepare_recipe_sysroot().
>>>>
>>>> Because of this mismatch, on rebuild, sstate_clean_manifest() will not clean
>>>> the files in recipe-sysroot, but will instead try to delete the non-existent
>>>> files in lib32-recipe-sysroot. This will trigger the FileExists errors later.
>>>>
>>>> Add checks in sstate_clean_manifest() for this corner case, so that
>>>> RECIPE_SYSROOT gets cleaned up properly.
>>>>
>>>> This fixes BZ#15045.
>>>>
>>>> Signed-off-by: Ovidiu Panait <ovidiu.panait@eng.windriver.com>
>>>> ---
>>>>    meta/classes-global/sstate.bbclass | 11 +++++++++++
>>>>    1 file changed, 11 insertions(+)
>>>>
>>>> diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass
>>>> index af93546b04..edf5c7fb65 100644
>>>> --- a/meta/classes-global/sstate.bbclass
>>>> +++ b/meta/classes-global/sstate.bbclass
>>>> @@ -529,9 +529,20 @@ def sstate_clean_manifest(manifest, d, canrace=False, prefix=None):
>>>>        entries = mfile.readlines()
>>>>        mfile.close()
>>>>
>>>> +    recipe_sysroot = d.getVar("RECIPE_SYSROOT").rstrip("/").rsplit('/', 1)[-1]
>>>> +
>>>>        for entry in entries:
>>>>            sstate_clean_entry(entry, canrace, prefix)
>>>>
>>>> +        # The sysroot directory stored in the manifest file might not be the
>>>> +        # same as RECIPE_SYSROOT, so the real sysroot will not be properly
>>>> +        # cleaned up on rebuild. Handle the cleanup here in order to avoid
>>>> +        # "File exists" errors during do_prepare_recipe_sysroot().
>>>> +        manifest_sysroot = entry.split("/", 1)[0] or None
>>>> +        if manifest_sysroot and manifest_sysroot != recipe_sysroot and not manifest_sysroot.endswith("-native"):
>>>> +            sysroot_entry = recipe_sysroot + "/" + entry.split("/", 1)[1]
>>>> +            sstate_clean_entry(sysroot_entry, canrace, prefix)
>>>> +
>>>>        postrm = manifest + ".postrm"
>>>>        if os.path.exists(manifest + ".postrm"):
>>>>            import subprocess
>>> I looked into this and as I suspected, the bug is elsewhere. I've sent
>>> a different patch to the staging.bbclass code which should fix this
>>> problem.
>> I tested with latest poky sources (with commit "staging: Separate out
>> different multiconfig manifests" present), but the same error is still
>> triggered on rebuild:
>>
>> 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'
>>
>> The manifest files still show lib32-recipe-sysroot instead of
>> recipe-sysroot (the manifest file seems to have already been cached by
>> lib32-gcc-cross-arm):
>> $ head -2
>> tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-arm/12.2.0-r0/recipe-sysroot-native/installeddeps/lib32-linux-libc-headers
>> lib32-recipe-sysroot/usr/include/asm/byteorder-32.h
>> lib32-recipe-sysroot/usr/include/asm/sigcontext-32.h
>>
>> MLPREFIX is set to lib32- for gcc-cross-canadian-arm, so the existing
>> manifest file with lib32-recipe-sysroot paths is used:
>> $ bitbake -e gcc-cross-canadian-arm | grep ^MLPREFIX
>> MLPREFIX="lib32-"
>>
>> Adding an exception for cross-canadian to the the mlprefix code added
>> earlier seems to make it work:
>>
>> diff --git a/meta/classes-global/staging.bbclass
>> b/meta/classes-global/staging.bbclass
>> index e6d0d1d55c..a9142ce780 100644
>> --- a/meta/classes-global/staging.bbclass
>> +++ b/meta/classes-global/staging.bbclass
>> @@ -276,6 +276,10 @@ python extend_recipe_sysroot() {
>>        stagingdir = d.getVar("STAGING_DIR")
>>        sharedmanifests = d.getVar("COMPONENTS_DIR") + "/manifests"
>>        mlprefix = d.getVar("MLPREFIX")
>> +    if "-cross-canadian" in pn:
>> +        mlprefix = "nativesdk-"
>>        if mlprefix:
>>            sharedmanifests = sharedmanifests + "/" + mlprefix
>>        recipesysroot = d.getVar("RECIPE_SYSROOT")
> Was this in a clean build? The change will need a clean TMPDIR to
> properly take effect. I didn't force everyone to rebuild since the
> issue is reported so rarely and has been present for a long time.
Yes, this is still reproducible in a clean build, with a fresh poky 
clone. Same steps as before:

git clone https://github.com/yoctoproject/poky.git;  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


Ovidiu



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [OE-core] [PATCH 2/2] sstate.bbclass: fix cleanup when sysroot in manifest != RECIPE_SYSROOT
  2023-03-08  6:52         ` Ovidiu Panait
@ 2023-03-08 10:18           ` Richard Purdie
  2023-03-08 11:35             ` Ovidiu Panait
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Purdie @ 2023-03-08 10:18 UTC (permalink / raw)
  To: Ovidiu Panait, Ovidiu Panait, openembedded-core

On Wed, 2023-03-08 at 08:52 +0200, Ovidiu Panait wrote:
> On 3/7/23 22:45, Richard Purdie wrote:
> > CAUTION: This email comes from a non Wind River email account!
> > Do not click links or open attachments unless you recognize the sender and know the content is safe.
> > 
> > On Tue, 2023-03-07 at 21:04 +0200, Ovidiu Panait wrote:
> > > 
> > > The manifest files still show lib32-recipe-sysroot instead of
> > > recipe-sysroot (the manifest file seems to have already been cached by
> > > lib32-gcc-cross-arm):
> > > $ head -2
> > > tmp/work/x86_64-nativesdk-pokysdk-linux/gcc-cross-canadian-arm/12.2.0-r0/recipe-sysroot-native/installeddeps/lib32-linux-libc-headers
> > > lib32-recipe-sysroot/usr/include/asm/byteorder-32.h
> > > lib32-recipe-sysroot/usr/include/asm/sigcontext-32.h
> > > 
> > > MLPREFIX is set to lib32- for gcc-cross-canadian-arm, so the existing
> > > manifest file with lib32-recipe-sysroot paths is used:
> > > $ bitbake -e gcc-cross-canadian-arm | grep ^MLPREFIX
> > > MLPREFIX="lib32-"
> > > 
> > > Adding an exception for cross-canadian to the the mlprefix code added
> > > earlier seems to make it work:
> > > 
> > > diff --git a/meta/classes-global/staging.bbclass
> > > b/meta/classes-global/staging.bbclass
> > > index e6d0d1d55c..a9142ce780 100644
> > > --- a/meta/classes-global/staging.bbclass
> > > +++ b/meta/classes-global/staging.bbclass
> > > @@ -276,6 +276,10 @@ python extend_recipe_sysroot() {
> > >        stagingdir = d.getVar("STAGING_DIR")
> > >        sharedmanifests = d.getVar("COMPONENTS_DIR") + "/manifests"
> > >        mlprefix = d.getVar("MLPREFIX")
> > > +    if "-cross-canadian" in pn:
> > > +        mlprefix = "nativesdk-"
> > >        if mlprefix:
> > >            sharedmanifests = sharedmanifests + "/" + mlprefix
> > >        recipesysroot = d.getVar("RECIPE_SYSROOT")
> > Was this in a clean build? The change will need a clean TMPDIR to
> > properly take effect. I didn't force everyone to rebuild since the
> > issue is reported so rarely and has been present for a long time.
> Yes, this is still reproducible in a clean build, with a fresh poky 
> clone. Same steps as before:
> 
> git clone https://github.com/yoctoproject/poky.git;  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
> 

Sorry, it looks like I messed something up in testing. The approach is
the right one but as you mention, it isn't quite working.

I've sent another patch which does work with the steps above. We can't
just use nativesdk since the file lists of the different canadian
targets may be different and would cause a different kind of failure. I
therefore tweaked the prefix accordingly and made the fix multilib
specific at the call site that triggers the issue.

Cheers,

Richard



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [OE-core] [PATCH 2/2] sstate.bbclass: fix cleanup when sysroot in manifest != RECIPE_SYSROOT
  2023-03-08 10:18           ` Richard Purdie
@ 2023-03-08 11:35             ` Ovidiu Panait
  0 siblings, 0 replies; 10+ messages in thread
From: Ovidiu Panait @ 2023-03-08 11:35 UTC (permalink / raw)
  To: Richard Purdie, Ovidiu Panait, openembedded-core


On 08.03.2023 12:18, Richard Purdie wrote:
>> Yes, this is still reproducible in a clean build, with a fresh poky
>> clone. Same steps as before:
>>
>> git clone https://github.com/yoctoproject/poky.git;  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
>>
> Sorry, it looks like I messed something up in testing. The approach is
> the right one but as you mention, it isn't quite working.
>
> I've sent another patch which does work with the steps above. We can't
> just use nativesdk since the file lists of the different canadian
> targets may be different and would cause a different kind of failure. I
> therefore tweaked the prefix accordingly and made the fix multilib
> specific at the call site that triggers the issue.

The new patch fixes the build for me as well, thanks a lot!


Ovidiu

> Cheers,
>
> Richard
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-03-08 11:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-27 15:42 [PATCH 1/2] sstate.bbclass: factor out manifest cleanup code from sstate_clean_manifest() Ovidiu Panait
2023-02-27 15:42 ` [PATCH 2/2] sstate.bbclass: fix cleanup when sysroot in manifest != RECIPE_SYSROOT Ovidiu Panait
2023-02-27 15:56   ` [OE-core] " Richard Purdie
2023-02-27 17:17     ` Ovidiu Panait
2023-03-06 17:59   ` Richard Purdie
2023-03-07 19:04     ` Ovidiu Panait
2023-03-07 20:45       ` Richard Purdie
2023-03-08  6:52         ` Ovidiu Panait
2023-03-08 10:18           ` Richard Purdie
2023-03-08 11:35             ` Ovidiu Panait

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.