diff mbox series

[RFC,3/5] musl: set compatibility a bit more flexible

Message ID 20251002000810.226673-3-denis@denix.org
State New
Headers show
Series [RFC,1/5] baremetal, linux-dummy: bypass kernel dependencies for baremetal | expand

Commit Message

Denys Dmytriyenko Oct. 2, 2025, 12:08 a.m. UTC
From: Denys Dmytriyenko <denys@konsulko.com>

Like musl Linux config, baremetal also uses musl as a libc, but
it has a different host triplet set. Hence adjust COMPATIBLE_HOST
to accomodate this use case by checking that musl is a preferred
provider of libc.

[YOCTO #15982]

Signed-off-by: Denys Dmytriyenko <denys@konsulko.com>
---
 meta/recipes-core/musl/bsd-headers.bb      | 2 +-
 meta/recipes-core/musl/libssp-nonshared.bb | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Khem Raj Oct. 2, 2025, 2:12 a.m. UTC | #1
On Wed, Oct 1, 2025 at 5:08 PM Denys Dmytriyenko via
lists.openembedded.org <denis=denix.org@lists.openembedded.org> wrote:
>
> From: Denys Dmytriyenko <denys@konsulko.com>
>
> Like musl Linux config, baremetal also uses musl as a libc, but
> it has a different host triplet set. Hence adjust COMPATIBLE_HOST
> to accomodate this use case by checking that musl is a preferred
> provider of libc.

This sounds a bit odd. Why do we use musl for baremetal targets ?
while musl does have FDPIC support but I don't think thats how we
use it.

>
> [YOCTO #15982]
>
> Signed-off-by: Denys Dmytriyenko <denys@konsulko.com>
> ---
>  meta/recipes-core/musl/bsd-headers.bb      | 2 +-
>  meta/recipes-core/musl/libssp-nonshared.bb | 3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/meta/recipes-core/musl/bsd-headers.bb b/meta/recipes-core/musl/bsd-headers.bb
> index ad9ba81e4f..c6a3814a49 100644
> --- a/meta/recipes-core/musl/bsd-headers.bb
> +++ b/meta/recipes-core/musl/bsd-headers.bb
> @@ -25,7 +25,7 @@ do_install() {
>  #
>  # We will skip parsing for non-musl systems
>  #
> +COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
>
> -COMPATIBLE_HOST = ".*-musl.*"
>  DEV_PKG_DEPENDENCY = ""
>  RRECOMMENDS:${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})"
> diff --git a/meta/recipes-core/musl/libssp-nonshared.bb b/meta/recipes-core/musl/libssp-nonshared.bb
> index 4bcbaef7ea..6f12ff0c9b 100644
> --- a/meta/recipes-core/musl/libssp-nonshared.bb
> +++ b/meta/recipes-core/musl/libssp-nonshared.bb
> @@ -29,7 +29,8 @@ do_install() {
>  #
>  # We will skip parsing for non-musl systems
>  #
> -COMPATIBLE_HOST = ".*-musl.*"
> +COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
> +
>  RDEPENDS:${PN}-staticdev = ""
>  DEV_PKG_DEPENDENCY = ""
>  RRECOMMENDS:${PN}-dbg = "${PN}-staticdev (= ${EXTENDPKGV})"
> --
> 2.25.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#224333): https://lists.openembedded.org/g/openembedded-core/message/224333
> Mute This Topic: https://lists.openembedded.org/mt/115544473/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Denys Dmytriyenko Oct. 2, 2025, 2:04 p.m. UTC | #2
On Wed, Oct 01, 2025 at 07:12:34PM -0700, Khem Raj wrote:
> On Wed, Oct 1, 2025 at 5:08 PM Denys Dmytriyenko via
> lists.openembedded.org <denis=denix.org@lists.openembedded.org> wrote:
> >
> > From: Denys Dmytriyenko <denys@konsulko.com>
> >
> > Like musl Linux config, baremetal also uses musl as a libc, but
> > it has a different host triplet set. Hence adjust COMPATIBLE_HOST
> > to accomodate this use case by checking that musl is a preferred
> > provider of libc.
> 
> This sounds a bit odd. Why do we use musl for baremetal targets ?

Was like that for 10 years since the beginning of baremetal support:
https://git.openembedded.org/openembedded-core/commit/?id=cb010e306a6a856c589db5f41fdcaea4e5035d93


> while musl does have FDPIC support but I don't think thats how we
> use it.
> 
> >
> > [YOCTO #15982]
> >
> > Signed-off-by: Denys Dmytriyenko <denys@konsulko.com>
> > ---
> >  meta/recipes-core/musl/bsd-headers.bb      | 2 +-
> >  meta/recipes-core/musl/libssp-nonshared.bb | 3 ++-
> >  2 files changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/meta/recipes-core/musl/bsd-headers.bb b/meta/recipes-core/musl/bsd-headers.bb
> > index ad9ba81e4f..c6a3814a49 100644
> > --- a/meta/recipes-core/musl/bsd-headers.bb
> > +++ b/meta/recipes-core/musl/bsd-headers.bb
> > @@ -25,7 +25,7 @@ do_install() {
> >  #
> >  # We will skip parsing for non-musl systems
> >  #
> > +COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
> >
> > -COMPATIBLE_HOST = ".*-musl.*"
> >  DEV_PKG_DEPENDENCY = ""
> >  RRECOMMENDS:${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})"
> > diff --git a/meta/recipes-core/musl/libssp-nonshared.bb b/meta/recipes-core/musl/libssp-nonshared.bb
> > index 4bcbaef7ea..6f12ff0c9b 100644
> > --- a/meta/recipes-core/musl/libssp-nonshared.bb
> > +++ b/meta/recipes-core/musl/libssp-nonshared.bb
> > @@ -29,7 +29,8 @@ do_install() {
> >  #
> >  # We will skip parsing for non-musl systems
> >  #
> > -COMPATIBLE_HOST = ".*-musl.*"
> > +COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
> > +
> >  RDEPENDS:${PN}-staticdev = ""
> >  DEV_PKG_DEPENDENCY = ""
> >  RRECOMMENDS:${PN}-dbg = "${PN}-staticdev (= ${EXTENDPKGV})"
> > --
> > 2.25.1
Khem Raj Oct. 2, 2025, 5:23 p.m. UTC | #3
On Thu, Oct 2, 2025 at 7:04 AM Denys Dmytriyenko <denis@denix.org> wrote:
>
> On Wed, Oct 01, 2025 at 07:12:34PM -0700, Khem Raj wrote:
> > On Wed, Oct 1, 2025 at 5:08 PM Denys Dmytriyenko via
> > lists.openembedded.org <denis=denix.org@lists.openembedded.org> wrote:
> > >
> > > From: Denys Dmytriyenko <denys@konsulko.com>
> > >
> > > Like musl Linux config, baremetal also uses musl as a libc, but
> > > it has a different host triplet set. Hence adjust COMPATIBLE_HOST
> > > to accomodate this use case by checking that musl is a preferred
> > > provider of libc.
> >
> > This sounds a bit odd. Why do we use musl for baremetal targets ?
>
> Was like that for 10 years since the beginning of baremetal support:
> https://git.openembedded.org/openembedded-core/commit/?id=cb010e306a6a856c589db5f41fdcaea4e5035d93
>

A lot has changed since then in terms of toolchain sequences and dependencies
it might be a good time to revise this

>
> > while musl does have FDPIC support but I don't think thats how we
> > use it.
> >
> > >
> > > [YOCTO #15982]
> > >
> > > Signed-off-by: Denys Dmytriyenko <denys@konsulko.com>
> > > ---
> > >  meta/recipes-core/musl/bsd-headers.bb      | 2 +-
> > >  meta/recipes-core/musl/libssp-nonshared.bb | 3 ++-
> > >  2 files changed, 3 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/meta/recipes-core/musl/bsd-headers.bb b/meta/recipes-core/musl/bsd-headers.bb
> > > index ad9ba81e4f..c6a3814a49 100644
> > > --- a/meta/recipes-core/musl/bsd-headers.bb
> > > +++ b/meta/recipes-core/musl/bsd-headers.bb
> > > @@ -25,7 +25,7 @@ do_install() {
> > >  #
> > >  # We will skip parsing for non-musl systems
> > >  #
> > > +COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
> > >
> > > -COMPATIBLE_HOST = ".*-musl.*"
> > >  DEV_PKG_DEPENDENCY = ""
> > >  RRECOMMENDS:${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})"
> > > diff --git a/meta/recipes-core/musl/libssp-nonshared.bb b/meta/recipes-core/musl/libssp-nonshared.bb
> > > index 4bcbaef7ea..6f12ff0c9b 100644
> > > --- a/meta/recipes-core/musl/libssp-nonshared.bb
> > > +++ b/meta/recipes-core/musl/libssp-nonshared.bb
> > > @@ -29,7 +29,8 @@ do_install() {
> > >  #
> > >  # We will skip parsing for non-musl systems
> > >  #
> > > -COMPATIBLE_HOST = ".*-musl.*"
> > > +COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
> > > +
> > >  RDEPENDS:${PN}-staticdev = ""
> > >  DEV_PKG_DEPENDENCY = ""
> > >  RRECOMMENDS:${PN}-dbg = "${PN}-staticdev (= ${EXTENDPKGV})"
> > > --
> > > 2.25.1
Denys Dmytriyenko Oct. 2, 2025, 7:31 p.m. UTC | #4
On Thu, Oct 02, 2025 at 10:23:25AM -0700, Khem Raj wrote:
> On Thu, Oct 2, 2025 at 7:04 AM Denys Dmytriyenko <denis@denix.org> wrote:
> >
> > On Wed, Oct 01, 2025 at 07:12:34PM -0700, Khem Raj wrote:
> > > On Wed, Oct 1, 2025 at 5:08 PM Denys Dmytriyenko via
> > > lists.openembedded.org <denis=denix.org@lists.openembedded.org> wrote:
> > > >
> > > > From: Denys Dmytriyenko <denys@konsulko.com>
> > > >
> > > > Like musl Linux config, baremetal also uses musl as a libc, but
> > > > it has a different host triplet set. Hence adjust COMPATIBLE_HOST
> > > > to accomodate this use case by checking that musl is a preferred
> > > > provider of libc.
> > >
> > > This sounds a bit odd. Why do we use musl for baremetal targets ?
> >
> > Was like that for 10 years since the beginning of baremetal support:
> > https://git.openembedded.org/openembedded-core/commit/?id=cb010e306a6a856c589db5f41fdcaea4e5035d93
> >
> 
> A lot has changed since then in terms of toolchain sequences and dependencies
> it might be a good time to revise this

Yeah, that would be the next step and is part of my longer todo list.

We've noticed that the baremetal toolchain build is now much larger and much 
longer than how it used to be several years ago - there seems to be a lot of 
unnecessary dependencies being pulled just to build a couple of self-contained 
firmware images... Still need to investigate further though.


> > > while musl does have FDPIC support but I don't think thats how we
> > > use it.
> > >
> > > >
> > > > [YOCTO #15982]
> > > >
> > > > Signed-off-by: Denys Dmytriyenko <denys@konsulko.com>
> > > > ---
> > > >  meta/recipes-core/musl/bsd-headers.bb      | 2 +-
> > > >  meta/recipes-core/musl/libssp-nonshared.bb | 3 ++-
> > > >  2 files changed, 3 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/meta/recipes-core/musl/bsd-headers.bb b/meta/recipes-core/musl/bsd-headers.bb
> > > > index ad9ba81e4f..c6a3814a49 100644
> > > > --- a/meta/recipes-core/musl/bsd-headers.bb
> > > > +++ b/meta/recipes-core/musl/bsd-headers.bb
> > > > @@ -25,7 +25,7 @@ do_install() {
> > > >  #
> > > >  # We will skip parsing for non-musl systems
> > > >  #
> > > > +COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
> > > >
> > > > -COMPATIBLE_HOST = ".*-musl.*"
> > > >  DEV_PKG_DEPENDENCY = ""
> > > >  RRECOMMENDS:${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})"
> > > > diff --git a/meta/recipes-core/musl/libssp-nonshared.bb b/meta/recipes-core/musl/libssp-nonshared.bb
> > > > index 4bcbaef7ea..6f12ff0c9b 100644
> > > > --- a/meta/recipes-core/musl/libssp-nonshared.bb
> > > > +++ b/meta/recipes-core/musl/libssp-nonshared.bb
> > > > @@ -29,7 +29,8 @@ do_install() {
> > > >  #
> > > >  # We will skip parsing for non-musl systems
> > > >  #
> > > > -COMPATIBLE_HOST = ".*-musl.*"
> > > > +COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
> > > > +
> > > >  RDEPENDS:${PN}-staticdev = ""
> > > >  DEV_PKG_DEPENDENCY = ""
> > > >  RRECOMMENDS:${PN}-dbg = "${PN}-staticdev (= ${EXTENDPKGV})"
> > > > --
> > > > 2.25.1
diff mbox series

Patch

diff --git a/meta/recipes-core/musl/bsd-headers.bb b/meta/recipes-core/musl/bsd-headers.bb
index ad9ba81e4f..c6a3814a49 100644
--- a/meta/recipes-core/musl/bsd-headers.bb
+++ b/meta/recipes-core/musl/bsd-headers.bb
@@ -25,7 +25,7 @@  do_install() {
 #
 # We will skip parsing for non-musl systems
 #
+COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
 
-COMPATIBLE_HOST = ".*-musl.*"
 DEV_PKG_DEPENDENCY = ""
 RRECOMMENDS:${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})"
diff --git a/meta/recipes-core/musl/libssp-nonshared.bb b/meta/recipes-core/musl/libssp-nonshared.bb
index 4bcbaef7ea..6f12ff0c9b 100644
--- a/meta/recipes-core/musl/libssp-nonshared.bb
+++ b/meta/recipes-core/musl/libssp-nonshared.bb
@@ -29,7 +29,8 @@  do_install() {
 #
 # We will skip parsing for non-musl systems
 #
-COMPATIBLE_HOST = ".*-musl.*"
+COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
+
 RDEPENDS:${PN}-staticdev = ""
 DEV_PKG_DEPENDENCY = ""
 RRECOMMENDS:${PN}-dbg = "${PN}-staticdev (= ${EXTENDPKGV})"