Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH v2 0/5] llvm/clang: fix some syntax issues in llvm-project-source
@ 2026-06-23 12:08 João Marcos Costa
  2026-06-23 12:08 ` [PATCH v2 1/5] llvm-project-source.inc: fix string replacements in do_preconfigure João Marcos Costa
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: João Marcos Costa @ 2026-06-23 12:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: thomas.petazzoni, raj.khem, João Marcos Costa

Hello,

I faced some strange build issues when switching from one distro to another
(i.e. DISTRO="poky" to DISTRO="foobar"), even after adding "foobar"
("foobar:foobar" actually) to CLANG_EXTRA_OE_DISTRO. I started investigating
what was wrong, and I believe the order of pathes in this series reflects pretty
well what specific issue I stumbled upon and what was the next one, on and on.

The error message was:

/src/build/tmp/work/riscv64imafdc-foobar-linux/libcxx/22.1.3/recipe-sysroot-native/usr/bin/riscv64-foobar-linux/riscv64-foobar-linux-ld: cannot find crtbeginS.o: No such file or directory
/src/build/tmp/work/riscv64imafdc-foobar-linux/libcxx/22.1.3/recipe-sysroot-native/usr/bin/riscv64-foobar-linux/riscv64-foobar-linux-ld: cannot find -lstdc++: No such file or directory
/src/build/tmp/work/riscv64imafdc-foobar-linux/libcxx/22.1.3/recipe-sysroot-native/usr/bin/riscv64-foobar-linux/riscv64-foobar-linux-ld: cannot find -lgcc: No such file or directory
riscv64-foobar-linux-clang++: error: linker command failed with exit code 1 (use -v to see invocation)

As far as I understand, this is precisely what do_preconfigure (+ some patches)
is supposed to handle, so at first it looked like a regression, but it seems the
error only reproduces when switching distros.

For some context, I was building something with
PREFERRED_TOOLCHAIN_TARGET="clang", using wrynose branch. If I use the custom
distro from the beginning (so no switching), everything works fine (as expected).

Best regards,

Changes in v2:
- squashed the patch* into 0016-llvm-clang-Insert-anchor-for-adding-OE-distro-vendor.patch
- added vardeps to do_unpack as well (5th patch)

* 0001-llvm-clang-Add-Distro-instance-to-getMultiarchTriple.patch

João Marcos Costa (5):
  llvm-project-source.inc: fix string replacements in do_preconfigure
  llvm-project-source.inc: fix end of line in triple variable
  clang/llvm: add missing instance of Distro class in Linux.cpp
  llvm-project-source.inc: add vardeps to do_preconfigure
  llvm-project-source.inc: add vardeps to do_unpack

 ...t-anchor-for-adding-OE-distro-vendor.patch | 35 ++++++++++++++-----
 .../clang/llvm-project-source.inc             |  8 +++--
 2 files changed, 31 insertions(+), 12 deletions(-)

-- 
2.43.0



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

* [PATCH v2 1/5] llvm-project-source.inc: fix string replacements in do_preconfigure
  2026-06-23 12:08 [PATCH v2 0/5] llvm/clang: fix some syntax issues in llvm-project-source João Marcos Costa
@ 2026-06-23 12:08 ` João Marcos Costa
  2026-06-23 12:08 ` [PATCH v2 2/5] llvm-project-source.inc: fix end of line in triple variable João Marcos Costa
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: João Marcos Costa @ 2026-06-23 12:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: thomas.petazzoni, raj.khem, João Marcos Costa

Both CLANG_EXTRA_OE_DISTRO_CASE and CLANG_EXTRA_OE_DISTRO_TRIPLE are
added by the same patch:

0016-llvm-clang-Insert-anchor-for-adding-OE-distro-vendor.patch

and they are supposed to be replaced by a couple of sed commands in
do_preconfigure. However, sed looks for CLANG_EXTRA_OE_DISTRO_CASES (and
CLANG_EXTRA_OE_DISTRO_TRIPLES) and since none is found, the code is left
with the dangling comment like so:

@ clang/lib/Driver/ToolChains/Linux.cpp
82     if (TargetEnvironment == llvm::Triple::GNUX32)
83       return "x86_64-linux-gnux32";
84     //CLANG_EXTRA_OE_DISTRO_TRIPLE
85     return "x86_64-linux-gnu";

Fix that by removing the 'S' in the end of ..._CASES and ..._TRIPLES.

Another way to fix this would be to directly change the patch, but
simply changing do_preconfigure feels cleaner.

Signed-off-by: João Marcos Costa <joaomarcos.costa@bootlin.com>
---
 meta/recipes-devtools/clang/llvm-project-source.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-devtools/clang/llvm-project-source.inc b/meta/recipes-devtools/clang/llvm-project-source.inc
index ba6cbf9a8d..6540d1cc7c 100644
--- a/meta/recipes-devtools/clang/llvm-project-source.inc
+++ b/meta/recipes-devtools/clang/llvm-project-source.inc
@@ -82,9 +82,9 @@ python do_preconfigure() {
     subprocess.check_output(cmd, stderr=subprocess.STDOUT)
     cmd = ['sed', '-i', 's#//CLANG_EXTRA_OE_DISTRO_CHECK#%s#g' % check, source + '/clang/include/clang/Driver/Distro.h']
     subprocess.check_output(cmd, stderr=subprocess.STDOUT)
-    cmd = ['sed', '-i', 's#//CLANG_EXTRA_OE_DISTRO_TRIPLES#%s#g' % triple, source + '/clang/lib/Driver/ToolChains/Linux.cpp']
+    cmd = ['sed', '-i', 's#//CLANG_EXTRA_OE_DISTRO_TRIPLE#%s#g' % triple, source + '/clang/lib/Driver/ToolChains/Linux.cpp']
     subprocess.check_output(cmd, stderr=subprocess.STDOUT)
-    cmd = ['sed', '-i', 's#//CLANG_EXTRA_OE_DISTRO_CASES#%s#g' % case, source + '/clang/lib/Driver/Distro.cpp']
+    cmd = ['sed', '-i', 's#//CLANG_EXTRA_OE_DISTRO_CASE#%s#g' % case, source + '/clang/lib/Driver/Distro.cpp']
     subprocess.check_output(cmd, stderr=subprocess.STDOUT)
 }
 
-- 
2.43.0



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

* [PATCH v2 2/5] llvm-project-source.inc: fix end of line in triple variable
  2026-06-23 12:08 [PATCH v2 0/5] llvm/clang: fix some syntax issues in llvm-project-source João Marcos Costa
  2026-06-23 12:08 ` [PATCH v2 1/5] llvm-project-source.inc: fix string replacements in do_preconfigure João Marcos Costa
@ 2026-06-23 12:08 ` João Marcos Costa
  2026-06-23 12:08 ` [PATCH v2 3/5] clang/llvm: add missing instance of Distro class in Linux.cpp João Marcos Costa
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: João Marcos Costa @ 2026-06-23 12:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: thomas.petazzoni, raj.khem, João Marcos Costa

After the return statement, a "," is present while a ";" is expected.

This leads to something like:

...return "x86_64-poky-linux",

Fix this syntax error by replacing "," with a ";".

Signed-off-by: João Marcos Costa <joaomarcos.costa@bootlin.com>
---
 meta/recipes-devtools/clang/llvm-project-source.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/clang/llvm-project-source.inc b/meta/recipes-devtools/clang/llvm-project-source.inc
index 6540d1cc7c..85b5ef06dc 100644
--- a/meta/recipes-devtools/clang/llvm-project-source.inc
+++ b/meta/recipes-devtools/clang/llvm-project-source.inc
@@ -71,7 +71,7 @@ python do_preconfigure() {
         distro_id = distro.split(":")[0].replace('-','_')
         distro_triple = distro.split(":")[1]
         case += '\\n    .Case("' + distro_id + '", Distro::' + distro_id.upper() + ')'
-        triple += '\\n   if (Distro.Is' + distro_id.upper() + '())\\n     return "x86_64-' + distro_triple + '-linux",'
+        triple += '\\n   if (Distro.Is' + distro_id.upper() + '())\\n     return "x86_64-' + distro_triple + '-linux";'
         name += '\\n    '+ distro_id.upper() + ','
         check += '\\nbool Is' + distro_id.upper() + '() const { return DistroVal == ' + distro_id.upper() + '; }'
         oe_names +=  distro_id.upper() + ' ||'
-- 
2.43.0



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

* [PATCH v2 3/5] clang/llvm: add missing instance of Distro class in Linux.cpp
  2026-06-23 12:08 [PATCH v2 0/5] llvm/clang: fix some syntax issues in llvm-project-source João Marcos Costa
  2026-06-23 12:08 ` [PATCH v2 1/5] llvm-project-source.inc: fix string replacements in do_preconfigure João Marcos Costa
  2026-06-23 12:08 ` [PATCH v2 2/5] llvm-project-source.inc: fix end of line in triple variable João Marcos Costa
@ 2026-06-23 12:08 ` João Marcos Costa
  2026-06-23 12:08 ` [PATCH v2 4/5] llvm-project-source.inc: add vardeps to do_preconfigure João Marcos Costa
  2026-06-23 12:08 ` [PATCH v2 5/5] llvm-project-source.inc: add vardeps to do_unpack João Marcos Costa
  4 siblings, 0 replies; 10+ messages in thread
From: João Marcos Costa @ 2026-06-23 12:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: thomas.petazzoni, raj.khem, João Marcos Costa

This instance will be used to perform the checks added by do_preconfigure
task, such as "Distro.IsOpenEmbedded()", or "Distro.IsPOKY()".

Without such instance, the compiler raises an "expected unqualified-id" error.

Something similar is performed by another patch, by the way:

0009-clang-Define-releative-gcc-installation-dir.patch:+  Distro Distro(D.getVFS(), TargetTriple);
0009-clang-Define-releative-gcc-installation-dir.patch:+           Distro.IsOpenEmbedded()},

Signed-off-by: João Marcos Costa <joaomarcos.costa@bootlin.com>
---
 ...t-anchor-for-adding-OE-distro-vendor.patch | 35 ++++++++++++++-----
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/meta/recipes-devtools/clang/clang/0016-llvm-clang-Insert-anchor-for-adding-OE-distro-vendor.patch b/meta/recipes-devtools/clang/clang/0016-llvm-clang-Insert-anchor-for-adding-OE-distro-vendor.patch
index c36d2973e6..674a3b264e 100644
--- a/meta/recipes-devtools/clang/clang/0016-llvm-clang-Insert-anchor-for-adding-OE-distro-vendor.patch
+++ b/meta/recipes-devtools/clang/clang/0016-llvm-clang-Insert-anchor-for-adding-OE-distro-vendor.patch
@@ -1,7 +1,10 @@
-From b14d66e6250566fb0b7786af92e3e83bade51c90 Mon Sep 17 00:00:00 2001
+From 259d8eb2ed82c9248387a3cbb1befee358ecbb8e Mon Sep 17 00:00:00 2001
 From: Hongxu Jia <hongxu.jia@windriver.com>
 Date: Mon, 25 Jan 2021 16:14:35 +0800
 Subject: [PATCH] llvm/clang: Insert anchor for adding OE distro vendor names
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
 
 This helps in making right detection for OE built gcc toolchains
 
@@ -82,22 +85,25 @@ b59da142f2b0:$ /path/to/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot
 programs: =/build/tmp-glibc/work/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin
 libraries: =/build/tmp-glibc/work/x84_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/lib/clang/13.0.1:/usr/lib/x86_64-wrs-linux/10.2.0://lib/x86_64-wrs-linux://usr/lib/x86_64-wrs-linux:/build/tmp-glibc/work/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/../lib://lib://usr/lib
 
+[JM: add missing instance of Distro class in getMultiarchTriple(), at Linux.cpp]
+
 Upstream-Status: Inappropriate [oe specific]
 
 Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
 Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
 Signed-off-by: Changqing Li <changqing.li@windriver.com>
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: João Marcos Costa <joaomarcos.costa@bootlin.com>
 ---
  clang/include/clang/Driver/Distro.h   | 2 ++
  clang/lib/Driver/Distro.cpp           | 1 +
  clang/lib/Driver/ToolChains/Gnu.cpp   | 1 +
- clang/lib/Driver/ToolChains/Linux.cpp | 1 +
+ clang/lib/Driver/ToolChains/Linux.cpp | 2 ++
  llvm/lib/TargetParser/Triple.cpp      | 2 +-
- 5 files changed, 6 insertions(+), 1 deletion(-)
+ 5 files changed, 7 insertions(+), 1 deletion(-)
 
 diff --git a/clang/include/clang/Driver/Distro.h b/clang/include/clang/Driver/Distro.h
-index 0e17b30eb7e8..b449a62dc299 100644
+index 0e17b30eb..b449a62dc 100644
 --- a/clang/include/clang/Driver/Distro.h
 +++ b/clang/include/clang/Driver/Distro.h
 @@ -45,6 +45,7 @@ public:
@@ -117,7 +123,7 @@ index 0e17b30eb7e8..b449a62dc299 100644
  };
  
 diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
-index df10458d092d..61dc127a4574 100644
+index df10458d0..61dc127a4 100644
 --- a/clang/lib/Driver/Distro.cpp
 +++ b/clang/lib/Driver/Distro.cpp
 @@ -43,6 +43,7 @@ static Distro::DistroType DetectOsRelease(llvm::vfs::FileSystem &VFS) {
@@ -129,7 +135,7 @@ index df10458d092d..61dc127a4574 100644
    return Version;
  }
 diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
-index c80980a7fb09..80fd8058bd98 100644
+index c80980a7f..80fd8058b 100644
 --- a/clang/lib/Driver/ToolChains/Gnu.cpp
 +++ b/clang/lib/Driver/ToolChains/Gnu.cpp
 @@ -2370,6 +2370,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
@@ -141,10 +147,18 @@ index c80980a7fb09..80fd8058bd98 100644
    static const char *const X32Triples[] = {"x86_64-linux-gnux32",
                                             "x86_64-pc-linux-gnux32"};
 diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
-index 7b608a84a66e..4a0adedce09a 100644
+index 7b608a84a..585a86a2d 100644
 --- a/clang/lib/Driver/ToolChains/Linux.cpp
 +++ b/clang/lib/Driver/ToolChains/Linux.cpp
-@@ -81,6 +81,7 @@ std::string Linux::getMultiarchTriple(const Driver &D,
+@@ -45,6 +45,7 @@ std::string Linux::getMultiarchTriple(const Driver &D,
+   bool IsAndroid = TargetTriple.isAndroid();
+   bool IsMipsR6 = TargetTriple.getSubArch() == llvm::Triple::MipsSubArch_r6;
+   bool IsMipsN32Abi = TargetTriple.getEnvironment() == llvm::Triple::GNUABIN32;
++  Distro Distro(D.getVFS(), TargetTriple);
+ 
+   // For most architectures, just use whatever we have rather than trying to be
+   // clever.
+@@ -81,6 +82,7 @@ std::string Linux::getMultiarchTriple(const Driver &D,
        return "x86_64-linux-android";
      if (TargetEnvironment == llvm::Triple::GNUX32)
        return "x86_64-linux-gnux32";
@@ -153,7 +167,7 @@ index 7b608a84a66e..4a0adedce09a 100644
    case llvm::Triple::aarch64:
      if (IsAndroid)
 diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp
-index a4f9dd42c0fe..86b74451ec0d 100644
+index a4f9dd42c..86b74451e 100644
 --- a/llvm/lib/TargetParser/Triple.cpp
 +++ b/llvm/lib/TargetParser/Triple.cpp
 @@ -702,7 +702,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) {
@@ -165,3 +179,6 @@ index a4f9dd42c0fe..86b74451ec0d 100644
        .Default(Triple::UnknownVendor);
  }
  
+-- 
+2.39.5
+
-- 
2.43.0



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

* [PATCH v2 4/5] llvm-project-source.inc: add vardeps to do_preconfigure
  2026-06-23 12:08 [PATCH v2 0/5] llvm/clang: fix some syntax issues in llvm-project-source João Marcos Costa
                   ` (2 preceding siblings ...)
  2026-06-23 12:08 ` [PATCH v2 3/5] clang/llvm: add missing instance of Distro class in Linux.cpp João Marcos Costa
@ 2026-06-23 12:08 ` João Marcos Costa
  2026-06-28 10:25   ` [OE-core] " Richard Purdie
  2026-06-23 12:08 ` [PATCH v2 5/5] llvm-project-source.inc: add vardeps to do_unpack João Marcos Costa
  4 siblings, 1 reply; 10+ messages in thread
From: João Marcos Costa @ 2026-06-23 12:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: thomas.petazzoni, raj.khem, João Marcos Costa

The task's signature should change if CLANG_EXTRA_OE_DISTRO and/or
CLANG_EXTRA_OE_VENDORS, considering the couple of for loops in
do_preconfigure iterate over their values.

By adding them to 'vardeps', bitbake will correctly detect if
do_preconfigure needs to be executed.

Signed-off-by: João Marcos Costa <joaomarcos.costa@bootlin.com>
---
 meta/recipes-devtools/clang/llvm-project-source.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/recipes-devtools/clang/llvm-project-source.inc b/meta/recipes-devtools/clang/llvm-project-source.inc
index 85b5ef06dc..84d4bae0ab 100644
--- a/meta/recipes-devtools/clang/llvm-project-source.inc
+++ b/meta/recipes-devtools/clang/llvm-project-source.inc
@@ -90,4 +90,5 @@ python do_preconfigure() {
 
 do_patch[vardepsexclude] += "MULTILIBS MULTILIB_VARIANTS"
 addtask do_preconfigure after do_patch
+do_preconfigure[vardeps] += "CLANG_EXTRA_OE_DISTRO CLANG_EXTRA_OE_VENDORS"
 do_create_spdx[depends] += "${PN}:do_preconfigure"
-- 
2.43.0



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

* [PATCH v2 5/5] llvm-project-source.inc: add vardeps to do_unpack
  2026-06-23 12:08 [PATCH v2 0/5] llvm/clang: fix some syntax issues in llvm-project-source João Marcos Costa
                   ` (3 preceding siblings ...)
  2026-06-23 12:08 ` [PATCH v2 4/5] llvm-project-source.inc: add vardeps to do_preconfigure João Marcos Costa
@ 2026-06-23 12:08 ` João Marcos Costa
  4 siblings, 0 replies; 10+ messages in thread
From: João Marcos Costa @ 2026-06-23 12:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: thomas.petazzoni, raj.khem, João Marcos Costa

The do_preconfigure task performs some string replacements, and the
patterns searched by sed are no longer there if they were replaced during a
previous (successful) execution.

This means we need to unpack the sources again, and apply the patches,
before running do_preconfigure again. Regarding do_patch, it is already
handled by the addtask line. However, even if we define a dependency (e.g.
with deptask flag) between do_preconfigure and do_unpack, bitbake will not
reexecute do_unpack because the stamp is still there.

The only workaround I see - not so elegant, yes - is to make sure
do_unpack's signature also depends on CLANG_EXTRA_OE_DISTRO and
CLANG_EXTRA_OE_VENDORS.

Signed-off-by: João Marcos Costa <joaomarcos.costa@bootlin.com>
---
 meta/recipes-devtools/clang/llvm-project-source.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/recipes-devtools/clang/llvm-project-source.inc b/meta/recipes-devtools/clang/llvm-project-source.inc
index 84d4bae0ab..7cc4e1a9f0 100644
--- a/meta/recipes-devtools/clang/llvm-project-source.inc
+++ b/meta/recipes-devtools/clang/llvm-project-source.inc
@@ -91,4 +91,5 @@ python do_preconfigure() {
 do_patch[vardepsexclude] += "MULTILIBS MULTILIB_VARIANTS"
 addtask do_preconfigure after do_patch
 do_preconfigure[vardeps] += "CLANG_EXTRA_OE_DISTRO CLANG_EXTRA_OE_VENDORS"
+do_unpack[vardeps] += "CLANG_EXTRA_OE_DISTRO CLANG_EXTRA_OE_VENDORS"
 do_create_spdx[depends] += "${PN}:do_preconfigure"
-- 
2.43.0



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

* Re: [OE-core] [PATCH v2 4/5] llvm-project-source.inc: add vardeps to do_preconfigure
  2026-06-23 12:08 ` [PATCH v2 4/5] llvm-project-source.inc: add vardeps to do_preconfigure João Marcos Costa
@ 2026-06-28 10:25   ` Richard Purdie
  2026-06-29  8:09     ` Joao Marcos Costa
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Purdie @ 2026-06-28 10:25 UTC (permalink / raw)
  To: joaomarcos.costa, openembedded-core; +Cc: thomas.petazzoni, raj.khem

On Tue, 2026-06-23 at 14:08 +0200, Joao Marcos Costa via lists.openembedded.org wrote:
> The task's signature should change if CLANG_EXTRA_OE_DISTRO and/or
> CLANG_EXTRA_OE_VENDORS, considering the couple of for loops in
> do_preconfigure iterate over their values.
> 
> By adding them to 'vardeps', bitbake will correctly detect if
> do_preconfigure needs to be executed.
> 
> Signed-off-by: João Marcos Costa <joaomarcos.costa@bootlin.com>
> ---
>  meta/recipes-devtools/clang/llvm-project-source.inc | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/meta/recipes-devtools/clang/llvm-project-source.inc b/meta/recipes-devtools/clang/llvm-project-source.inc
> index 85b5ef06dc..84d4bae0ab 100644
> --- a/meta/recipes-devtools/clang/llvm-project-source.inc
> +++ b/meta/recipes-devtools/clang/llvm-project-source.inc
> @@ -90,4 +90,5 @@ python do_preconfigure() {
>  
>  do_patch[vardepsexclude] += "MULTILIBS MULTILIB_VARIANTS"
>  addtask do_preconfigure after do_patch
> +do_preconfigure[vardeps] += "CLANG_EXTRA_OE_DISTRO CLANG_EXTRA_OE_VENDORS"
>  do_create_spdx[depends] += "${PN}:do_preconfigure"

We require that tasks can run in isolation and that can happen for many
different reasons. Your fix does improve things a bit but it doesn't
fix the underlying problem.

Ideally we'd change the search/replace expressions so that they always
change/update the required entries. That does sometimes need a bit more
thought about how the expressions work and it means you can't use
replacement tokens (unless as a comment on the line above?).

Another less optimal way to improve things is to change do_preconfigure
into a postfunc for do_unpack, but it wouldn't be able to change things
altered by do_patch. You can't make it a do_patch postfunc as it could
still have the current issues with the changes not being updated.

Cheers,

Richard


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

* Re: [OE-core] [PATCH v2 4/5] llvm-project-source.inc: add vardeps to do_preconfigure
  2026-06-28 10:25   ` [OE-core] " Richard Purdie
@ 2026-06-29  8:09     ` Joao Marcos Costa
  2026-06-29  9:39       ` Richard Purdie
  0 siblings, 1 reply; 10+ messages in thread
From: Joao Marcos Costa @ 2026-06-29  8:09 UTC (permalink / raw)
  To: richard.purdie, openembedded-core; +Cc: thomas.petazzoni, raj.khem

Hello, Richard

On 6/28/26 12:25, Richard Purdie via lists.openembedded.org wrote:
> On Tue, 2026-06-23 at 14:08 +0200, Joao Marcos Costa via lists.openembedded.org wrote:
>> The task's signature should change if CLANG_EXTRA_OE_DISTRO and/or
>> CLANG_EXTRA_OE_VENDORS, considering the couple of for loops in
>> do_preconfigure iterate over their values.
>>
>> By adding them to 'vardeps', bitbake will correctly detect if
>> do_preconfigure needs to be executed.
>>
>> Signed-off-by: João Marcos Costa <joaomarcos.costa@bootlin.com>
>> ---
>>   meta/recipes-devtools/clang/llvm-project-source.inc | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/meta/recipes-devtools/clang/llvm-project-source.inc b/meta/recipes-devtools/clang/llvm-project-source.inc
>> index 85b5ef06dc..84d4bae0ab 100644
>> --- a/meta/recipes-devtools/clang/llvm-project-source.inc
>> +++ b/meta/recipes-devtools/clang/llvm-project-source.inc
>> @@ -90,4 +90,5 @@ python do_preconfigure() {
>>   
>>   do_patch[vardepsexclude] += "MULTILIBS MULTILIB_VARIANTS"
>>   addtask do_preconfigure after do_patch
>> +do_preconfigure[vardeps] += "CLANG_EXTRA_OE_DISTRO CLANG_EXTRA_OE_VENDORS"
>>   do_create_spdx[depends] += "${PN}:do_preconfigure"
> 
> We require that tasks can run in isolation and that can happen for many
> different reasons. Your fix does improve things a bit but it doesn't
> fix the underlying problem.
> 
> Ideally we'd change the search/replace expressions so that they always
> change/update the required entries. That does sometimes need a bit more
> thought about how the expressions work and it means you can't use
> replacement tokens (unless as a comment on the line above?).
> 
> Another less optimal way to improve things is to change do_preconfigure
> into a postfunc for do_unpack, but it wouldn't be able to change things
> altered by do_patch. You can't make it a do_patch postfunc as it could
> still have the current issues with the changes not being updated.
> 
> Cheers,
> 
> Richard

I see your point. I'd be more eager to have a reproducible 
search/replace strategy than using postfuncs, but this would require 
some more time, and I will soon be OOO for a few days.

What is the perspective for this series? Does it heavily depend on this 
last part? I would prefer not to delay this fix any longer, and I could 
send another series later to add some testing (to avoid regressions in 
the future), and a more solid search/replace in do_preconfigure.

-- 
Best regards,
João Marcos Costa


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

* Re: [OE-core] [PATCH v2 4/5] llvm-project-source.inc: add vardeps to do_preconfigure
  2026-06-29  8:09     ` Joao Marcos Costa
@ 2026-06-29  9:39       ` Richard Purdie
  2026-06-29  9:51         ` Joao Marcos Costa
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Purdie @ 2026-06-29  9:39 UTC (permalink / raw)
  To: Joao Marcos Costa, openembedded-core; +Cc: thomas.petazzoni, raj.khem

On Mon, 2026-06-29 at 10:09 +0200, Joao Marcos Costa wrote:
> On 6/28/26 12:25, Richard Purdie via lists.openembedded.org wrote:
> > On Tue, 2026-06-23 at 14:08 +0200, Joao Marcos Costa via lists.openembedded.org wrote:
> > > The task's signature should change if CLANG_EXTRA_OE_DISTRO and/or
> > > CLANG_EXTRA_OE_VENDORS, considering the couple of for loops in
> > > do_preconfigure iterate over their values.
> > > 
> > > By adding them to 'vardeps', bitbake will correctly detect if
> > > do_preconfigure needs to be executed.
> > > 
> > > Signed-off-by: João Marcos Costa <joaomarcos.costa@bootlin.com>
> > > ---
> > >   meta/recipes-devtools/clang/llvm-project-source.inc | 1 +
> > >   1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/meta/recipes-devtools/clang/llvm-project-source.inc b/meta/recipes-devtools/clang/llvm-project-source.inc
> > > index 85b5ef06dc..84d4bae0ab 100644
> > > --- a/meta/recipes-devtools/clang/llvm-project-source.inc
> > > +++ b/meta/recipes-devtools/clang/llvm-project-source.inc
> > > @@ -90,4 +90,5 @@ python do_preconfigure() {
> > >   
> > >   do_patch[vardepsexclude] += "MULTILIBS MULTILIB_VARIANTS"
> > >   addtask do_preconfigure after do_patch
> > > +do_preconfigure[vardeps] += "CLANG_EXTRA_OE_DISTRO CLANG_EXTRA_OE_VENDORS"
> > >   do_create_spdx[depends] += "${PN}:do_preconfigure"
> > 
> > We require that tasks can run in isolation and that can happen for many
> > different reasons. Your fix does improve things a bit but it doesn't
> > fix the underlying problem.
> > 
> > Ideally we'd change the search/replace expressions so that they always
> > change/update the required entries. That does sometimes need a bit more
> > thought about how the expressions work and it means you can't use
> > replacement tokens (unless as a comment on the line above?).
> > 
> > Another less optimal way to improve things is to change do_preconfigure
> > into a postfunc for do_unpack, but it wouldn't be able to change things
> > altered by do_patch. You can't make it a do_patch postfunc as it could
> > still have the current issues with the changes not being updated.
> > 
> > Cheers,
> > 
> > Richard
> 
> I see your point. I'd be more eager to have a reproducible 
> search/replace strategy than using postfuncs, but this would require 
> some more time, and I will soon be OOO for a few days.
> 
> What is the perspective for this series? Does it heavily depend on this 
> last part? I would prefer not to delay this fix any longer, and I could 
> send another series later to add some testing (to avoid regressions in 
> the future), and a more solid search/replace in do_preconfigure.

I've merged the first 3 patches, those makes sense on their own. I'm a
bit more reluctant for the last two as I really would like to fix the
issue correctly...

Cheers,

Richard




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

* Re: [OE-core] [PATCH v2 4/5] llvm-project-source.inc: add vardeps to do_preconfigure
  2026-06-29  9:39       ` Richard Purdie
@ 2026-06-29  9:51         ` Joao Marcos Costa
  0 siblings, 0 replies; 10+ messages in thread
From: Joao Marcos Costa @ 2026-06-29  9:51 UTC (permalink / raw)
  To: Richard Purdie, openembedded-core; +Cc: thomas.petazzoni, raj.khem

Hello,

On 6/29/26 11:39, Richard Purdie wrote:

> I've merged the first 3 patches, those makes sense on their own. I'm a
> bit more reluctant for the last two as I really would like to fix the
> issue correctly...
> 
> Cheers,
> 
> Richard

I'll add that to my to-do list then. Thanks!

-- 
Best regards,
João Marcos Costa


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

end of thread, other threads:[~2026-06-29  9:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-23 12:08 [PATCH v2 0/5] llvm/clang: fix some syntax issues in llvm-project-source João Marcos Costa
2026-06-23 12:08 ` [PATCH v2 1/5] llvm-project-source.inc: fix string replacements in do_preconfigure João Marcos Costa
2026-06-23 12:08 ` [PATCH v2 2/5] llvm-project-source.inc: fix end of line in triple variable João Marcos Costa
2026-06-23 12:08 ` [PATCH v2 3/5] clang/llvm: add missing instance of Distro class in Linux.cpp João Marcos Costa
2026-06-23 12:08 ` [PATCH v2 4/5] llvm-project-source.inc: add vardeps to do_preconfigure João Marcos Costa
2026-06-28 10:25   ` [OE-core] " Richard Purdie
2026-06-29  8:09     ` Joao Marcos Costa
2026-06-29  9:39       ` Richard Purdie
2026-06-29  9:51         ` Joao Marcos Costa
2026-06-23 12:08 ` [PATCH v2 5/5] llvm-project-source.inc: add vardeps to do_unpack João Marcos Costa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox