From: Mark Hatle <mark.hatle@amd.com>
To: <openembedded-core@lists.openembedded.org>
Subject: [PATCH] multilib.bbclass: Check COMPATIBLE_HOST and abort early
Date: Sun, 15 Nov 2026 15:14:01 -0700 [thread overview]
Message-ID: <20261115221401.758706-1-mark.hatle@amd.com> (raw)
The change duplicates the base.bbclass COMPATIBLE_HOST check in the
multilib.bbclass, after doing a basic expansion to quickly exit if
there is no reason to expand this recipe into a multilib.
For a baremetal SDK toolchain, there is a configuration that contains
54 multilibs. This causes a pathalogical case of multilib expansion.
To attempt to prevent unnecessary multlib expansion, the baremetal
distribution sets:
COMPATOS = ""
# Set the regex for target recipes only, follow TARGET_OS default
COMPATOS:class-target = ".*-linux${LIBCEXTENSION}${ABIEXTENSION}"
COMPATIBLE_HOST ?= "${COMPATOS}"
Parse time still was taking almost 18 minutes. It was determined that
the system was still expanding most recipes and then deciding the
multilib was not useful in that environment.
With the change, we now detect the COMPATIBLE_HOST sooner in the
multilib expansion and raise an exception if it should not be expanded.
This lowers the parse time down to about 90 seconds for the same
configuration.
AI-Generated: Uses GitHub Copilot
Signed-off-by: Mark Hatle <mark.hatle@amd.com>
---
The Clause via Copilot helped me determine this case. In my baremetal
SDK for microblaze, I have a configuration with 54 multilibs defined.
This takes an exteremly long time (18 minutes or so) to parse before
any building begins. With this change, it drops down to about 90s.
I've looked at this change, and I understand clearly what it's doing
and why, but I'm not really sure if it's right. Also I'm not sure
if there may be additional checks that should also be done at this
point to help reduce the number of multilibs being processed when it
is not necessary. (i.e. SKIP_RECIPE or other reasons.)
meta/classes/multilib.bbclass | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/meta/classes/multilib.bbclass b/meta/classes/multilib.bbclass
index 55b8aee882..b178d64f7b 100644
--- a/meta/classes/multilib.bbclass
+++ b/meta/classes/multilib.bbclass
@@ -72,6 +72,27 @@ python multilib_virtclass_handler () {
and not bb.data.inherits_class('packagegroup', d)):
raise bb.parse.SkipRecipe("Don't extend allarch recipes which are not packagegroups")
+ # Apply base.bbclass's COMPATIBLE_HOST check before the setup below. That
+ # setup (e.g. expanding ALL_MULTILIB_PACKAGE_ARCHS) creates a datastore per
+ # multilib, so doing it for every variant only for base.bbclass to skip it
+ # later is quadratic in the number of multilibs and dominates parse time for
+ # configurations with many of them (e.g. baremetal toolchains). The variant's
+ # tune isn't in place yet, so evaluate HOST_SYS in a copy which has it.
+ source_mirror_fetch = bb.utils.to_boolean(d.getVar('SOURCE_MIRROR_FETCH', False)) or \
+ bb.utils.to_boolean(d.getVar('PARSE_ALL_RECIPES', False))
+ if not source_mirror_fetch:
+ mldata = bb.data.createCopy(d)
+ mldata.setVar("OVERRIDES", mldata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + variant)
+ mltune = mldata.getVar("DEFAULTTUNE:virtclass-multilib-" + variant, False)
+ if mltune:
+ mldata.setVar("DEFAULTTUNE", mltune)
+ need_host = mldata.getVar('COMPATIBLE_HOST')
+ if need_host:
+ import re
+ this_host = mldata.getVar('HOST_SYS')
+ if not re.match(need_host, this_host):
+ raise bb.parse.SkipRecipe("incompatible with host %s (not in COMPATIBLE_HOST)" % this_host)
+
# Expand this since this won't work correctly once we set a multilib into place
d.setVar("ALL_MULTILIB_PACKAGE_ARCHS", d.getVar("ALL_MULTILIB_PACKAGE_ARCHS"))
--
2.34.1
reply other threads:[~2026-11-15 22:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261115221401.758706-1-mark.hatle@amd.com \
--to=mark.hatle@amd.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox