All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ptest, packagegroup-core-buildessential: Add clang with clang toolchain
@ 2026-11-08 20:46 Khem Raj
  2026-11-12 14:25 ` [OE-core] " Ross Burton
  2026-11-26 14:51 ` Paul Barker
  0 siblings, 2 replies; 4+ messages in thread
From: Khem Raj @ 2026-11-08 20:46 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

When the target is built with the clang toolchain, python's sysconfig
and perl's Config record ${TARGET_PREFIX}clang as the C compiler, so
anything compiling on the target through them fails when only gcc is
installed:

  FileNotFoundError: [Errno 2] No such file or directory: 'x86_64-yoe-linux-clang'

The target clang package installs the ${TARGET_PREFIX}clang symlinks.
Add it to packagegroup-core-buildessential, and in ptest.bbclass append
it to the ptest RDEPENDS of any recipe built with clang whose ptest
already pulls in gcc, g++, their -symlinks packages or
packagegroup-core-buildessential. This covers python3, python3-cffi,
elfutils and others without per-recipe appends.

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
 meta/classes-recipe/ptest.bbclass                         | 8 ++++++++
 .../packagegroups/packagegroup-core-buildessential.bb     | 1 +
 2 files changed, 9 insertions(+)

diff --git a/meta/classes-recipe/ptest.bbclass b/meta/classes-recipe/ptest.bbclass
index 0f80fbc1d8..de77089002 100644
--- a/meta/classes-recipe/ptest.bbclass
+++ b/meta/classes-recipe/ptest.bbclass
@@ -136,6 +136,14 @@ python () {
     if not(d.getVar('PTEST_ENABLED') == "1"):
         for i in ['do_configure_ptest_base', 'do_compile_ptest_base', 'do_install_ptest_base']:
             bb.build.deltask(i, d)
+
+    # On-target compile tests need the clang driver when built with clang
+    if d.getVar('TCOVERRIDE') == 'toolchain-clang':
+        var = 'RDEPENDS:%s-ptest' % d.getVar('PN')
+        rdeps = bb.utils.explode_deps(d.getVar(var) or '')
+        if any(p in rdeps for p in ('gcc', 'gcc-symlinks', 'g++', 'g++-symlinks',
+                                    'packagegroup-core-buildessential')):
+            d.appendVar(var, ' clang')
 }
 
 QARECIPETEST[missing-ptest] = "package_qa_check_missing_ptest"
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb b/meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb
index 2cd67ad05f..d33af54d26 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb
@@ -29,3 +29,4 @@ RDEPENDS:packagegroup-core-buildessential = "\
     pkgconfig \
     "
 
+RDEPENDS:packagegroup-core-buildessential:append:toolchain-clang = " clang"

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

* Re: [OE-core] [PATCH] ptest, packagegroup-core-buildessential: Add clang with clang toolchain
  2026-11-08 20:46 [PATCH] ptest, packagegroup-core-buildessential: Add clang with clang toolchain Khem Raj
@ 2026-11-12 14:25 ` Ross Burton
  2026-11-15 21:05   ` Khem Raj
  2026-11-26 14:51 ` Paul Barker
  1 sibling, 1 reply; 4+ messages in thread
From: Ross Burton @ 2026-11-12 14:25 UTC (permalink / raw)
  To: raj.khem@gmail.com; +Cc: openembedded-core@lists.openembedded.org, Khem Raj

On 8 Nov 2026, at 20:46, Khem Raj via openembedded-core <raj.khem=gmail.com@lists.openembedded.org> wrote:
> The target clang package installs the ${TARGET_PREFIX}clang symlinks.
> Add it to packagegroup-core-buildessential, and in ptest.bbclass append
> it to the ptest RDEPENDS of any recipe built with clang whose ptest
> already pulls in gcc, g++, their -symlinks packages or
> packagegroup-core-buildessential. This covers python3, python3-cffi,
> elfutils and others without per-recipe appends.

This feels like the wrong solution, especially as you’ll end up with packages depending on both gcc and clang.

I’ve some patches locally that change python to do :append:toolchain-gcc and :append:toolchain-clang, but maybe we need a variable that is “the toolchain RDEPENDS” for cases like this, that the toolchain classes can set?

Something like TARGET_TOOLCHAIN_RDEPENDS = “gcc-symlinks” in gcc.bbclass maybe? Then recipes that respect the compiler choice can use that and will pull in the right packages automatically.

Ross

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

* Re: [OE-core] [PATCH] ptest, packagegroup-core-buildessential: Add clang with clang toolchain
  2026-11-12 14:25 ` [OE-core] " Ross Burton
@ 2026-11-15 21:05   ` Khem Raj
  0 siblings, 0 replies; 4+ messages in thread
From: Khem Raj @ 2026-11-15 21:05 UTC (permalink / raw)
  To: Ross Burton; +Cc: openembedded-core@lists.openembedded.org, Khem Raj

[-- Attachment #1: Type: text/plain, Size: 1643 bytes --]

On Thu, Nov 12, 2026 at 6:26 AM Ross Burton <Ross.Burton@arm.com> wrote:

> On 8 Nov 2026, at 20:46, Khem Raj via openembedded-core <raj.khem=
> gmail.com@lists.openembedded.org> wrote:
> > The target clang package installs the ${TARGET_PREFIX}clang symlinks.
> > Add it to packagegroup-core-buildessential, and in ptest.bbclass append
> > it to the ptest RDEPENDS of any recipe built with clang whose ptest
> > already pulls in gcc, g++, their -symlinks packages or
> > packagegroup-core-buildessential. This covers python3, python3-cffi,
> > elfutils and others without per-recipe appends.
>
> This feels like the wrong solution, especially as you’ll end up with
> packages depending on both gcc and clang.
>

We can remove gcc from depends along with adding clang, its a ptest dep and
what does such a micro optimization get us?


>
> I’ve some patches locally that change python to do :append:toolchain-gcc
> and :append:toolchain-clang, but maybe we need a variable that is “the
> toolchain RDEPENDS” for cases like this, that the toolchain classes can set?
>

python is not the problem, it's a symptom where another recipe needs to
know what compiler was used to compile python in order to decide its ptest
dependencies to be gcc or clang.

>
> Something like TARGET_TOOLCHAIN_RDEPENDS = “gcc-symlinks” in gcc.bbclass
> maybe? Then recipes that respect the compiler choice can use that and will
> pull in the right packages automatically.
>
>
This suggestion may not fix the problem at hand but it will atleast make
OE system to not have gcc as default compiler assumption.


> Ross

[-- Attachment #2: Type: text/html, Size: 2552 bytes --]

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

* Re: [PATCH] ptest, packagegroup-core-buildessential: Add clang with clang toolchain
  2026-11-08 20:46 [PATCH] ptest, packagegroup-core-buildessential: Add clang with clang toolchain Khem Raj
  2026-11-12 14:25 ` [OE-core] " Ross Burton
@ 2026-11-26 14:51 ` Paul Barker
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Barker @ 2026-11-26 14:51 UTC (permalink / raw)
  To: Khem Raj, openembedded-core; +Cc: Khem Raj

On Sun Nov 8, 2026 at 8:46 PM GMT, Khem Raj wrote:
> When the target is built with the clang toolchain, python's sysconfig
> and perl's Config record ${TARGET_PREFIX}clang as the C compiler, so
> anything compiling on the target through them fails when only gcc is
> installed:
>
>   FileNotFoundError: [Errno 2] No such file or directory: 'x86_64-yoe-linux-clang'
>
> The target clang package installs the ${TARGET_PREFIX}clang symlinks.
> Add it to packagegroup-core-buildessential, and in ptest.bbclass append
> it to the ptest RDEPENDS of any recipe built with clang whose ptest
> already pulls in gcc, g++, their -symlinks packages or
> packagegroup-core-buildessential. This covers python3, python3-cffi,
> elfutils and others without per-recipe appends.
>
> Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
> ---
>  meta/classes-recipe/ptest.bbclass                         | 8 ++++++++
>  .../packagegroups/packagegroup-core-buildessential.bb     | 1 +
>  2 files changed, 9 insertions(+)
>
> diff --git a/meta/classes-recipe/ptest.bbclass b/meta/classes-recipe/ptest.bbclass
> index 0f80fbc1d8..de77089002 100644
> --- a/meta/classes-recipe/ptest.bbclass
> +++ b/meta/classes-recipe/ptest.bbclass
> @@ -136,6 +136,14 @@ python () {
>      if not(d.getVar('PTEST_ENABLED') == "1"):
>          for i in ['do_configure_ptest_base', 'do_compile_ptest_base', 'do_install_ptest_base']:
>              bb.build.deltask(i, d)
> +
> +    # On-target compile tests need the clang driver when built with clang
> +    if d.getVar('TCOVERRIDE') == 'toolchain-clang':
> +        var = 'RDEPENDS:%s-ptest' % d.getVar('PN')
> +        rdeps = bb.utils.explode_deps(d.getVar(var) or '')
> +        if any(p in rdeps for p in ('gcc', 'gcc-symlinks', 'g++', 'g++-symlinks',
> +                                    'packagegroup-core-buildessential')):
> +            d.appendVar(var, ' clang')
>  }
>  
>  QARECIPETEST[missing-ptest] = "package_qa_check_missing_ptest"
> diff --git a/meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb b/meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb
> index 2cd67ad05f..d33af54d26 100644
> --- a/meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb
> +++ b/meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb
> @@ -29,3 +29,4 @@ RDEPENDS:packagegroup-core-buildessential = "\
>      pkgconfig \
>      "
>  
> +RDEPENDS:packagegroup-core-buildessential:append:toolchain-clang = " clang"

Hi Khem,

One comment in addition to what Ross has said.

When using clang, this patch is adding clang to the dependencies of
packagegroup-core-buildessential in both ways. I think we can just keep
the RDEPENDS append in packagegroup-core-buildessential.bb and drop
packagegroup-core-buildessential from the list to be modified in
ptest.bbclass.

Best regards,

-- 
Paul Barker


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

end of thread, other threads:[~2026-11-26 14:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-08 20:46 [PATCH] ptest, packagegroup-core-buildessential: Add clang with clang toolchain Khem Raj
2026-11-12 14:25 ` [OE-core] " Ross Burton
2026-11-15 21:05   ` Khem Raj
2026-11-26 14:51 ` Paul Barker

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.