public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Felix Moessbauer' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: wzh@ilbers.de, jan.kiszka@siemens.com,
	Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [PATCH 1/1] sbuild-chroot: fix incompatible dependency optimization
Date: Fri, 24 Jul 2026 15:47:49 +0200	[thread overview]
Message-ID: <20260724134749.1150268-1-felix.moessbauer@siemens.com> (raw)

The dependency tree around build-essential is complex. On
architectures which cannot be cross-compiled incompatible with our
build-time optimization of pre-installing packages usually needed for
building. As the PACKAGE_ARCH = <host> packages are always compiled in
the sbuild-chroot-host, this chroot needs to be installable.

For archs that cannot be cross-compiled due to internal dependency
issues (like mipsel), we must not install any cross tooling into the
host chroot (as this cannot be installed). To not specialize for
specific architectures, we optimize this by only installing the cross
tooling into the sbuild-chroot-host if ISAR_CROSS_COMPILE is enabled.
By that, the install time of the chroot is also reduced, as less
not-needed dependencies are installed.

This fixes the following error:
 The following packages have unmet dependencies:
  libc6-dev : Depends: linux-libc-dev but it is not installable
 E: Unable to correct problems, you have held broken packages.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 .../sbuild-chroot/sbuild-chroot-host.bb        |  2 +-
 .../sbuild-chroot/sbuild-chroot-target.bb      |  1 +
 .../sbuild-chroot/sbuild-chroot.inc            | 18 +++++++++++-------
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-host.bb b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-host.bb
index 3e66a7f4..52a461fe 100644
--- a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-host.bb
+++ b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-host.bb
@@ -15,6 +15,6 @@ ROOTFS_BASE_DISTRO = "${HOST_BASE_DISTRO}"
 
 SBUILD_CHROOT_PREINSTALL ?= " \
     ${SBUILD_CHROOT_PREINSTALL_COMMON} \
-    crossbuild-essential-${DISTRO_ARCH} \
+    ${@ 'libc6-dev:${DISTRO_ARCH} crossbuild-essential-${DISTRO_ARCH}' if bb.utils.to_boolean(d.getVar('ISAR_CROSS_COMPILE')) else ''} \
     apt-utils \
     "
diff --git a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-target.bb b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-target.bb
index 763453e6..05d24b97 100644
--- a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-target.bb
+++ b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-target.bb
@@ -11,5 +11,6 @@ require sbuild-chroot.inc
 
 SBUILD_CHROOT_PREINSTALL ?= " \
     ${SBUILD_CHROOT_PREINSTALL_COMMON} \
+    libc6-dev:${DISTRO_ARCH} \
     ${@' apt-utils' if bb.utils.to_boolean(d.getVar('ISAR_ENABLE_COMPAT_ARCH')) else ''} \
     "
diff --git a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
index 054d7fc2..80c43d20 100644
--- a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
+++ b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
@@ -20,8 +20,11 @@ SBUILD_CHROOT_PREINSTALL_EXTRA ??= ""
 python() {
     distro_gcc = d.getVar('DISTRO_GCC')
     distro_arch = d.getVar('DISTRO_ARCH')
+    rootfs_arch = d.getVar('ROOTFS_ARCH')
+    cross = bb.utils.to_boolean(d.getVar('ISAR_CROSS_COMPILE'))
+    install_distro_arch_tooling = cross or rootfs_arch == distro_arch
 
-    if d.getVar('DISTRO_GCC'):
+    if distro_gcc and install_distro_arch_tooling:
         d.appendVar('SBUILD_CHROOT_PREINSTALL_COMMON',
                     f" libgcc-{distro_gcc}-dev:{distro_arch}")
         d.appendVar('SBUILD_CHROOT_PREINSTALL_COMMON',
@@ -29,11 +32,13 @@ python() {
 
     if bb.utils.to_boolean(d.getVar('ISAR_ENABLE_COMPAT_ARCH')):
         compat_arch = d.getVar('COMPAT_DISTRO_ARCH')
-        d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
-                    f" libc6-dev:{compat_arch}")
-        d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
-                    f" crossbuild-essential-{compat_arch}")
-        if d.getVar('DISTRO_GCC'):
+        if install_distro_arch_tooling:
+            d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
+                        f" libc6-dev:{compat_arch}")
+            d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
+                        f" crossbuild-essential-{compat_arch}")
+
+        if distro_gcc and install_distro_arch_tooling:
             d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
                         f" libgcc-{distro_gcc}-dev:{compat_arch}")
             d.appendVar('SBUILD_CHROOT_COMPAT_PREINSTALL',
@@ -43,7 +48,6 @@ python() {
 SBUILD_CHROOT_PREINSTALL_COMMON = " \
     ${SBUILD_CHROOT_COMPAT_PREINSTALL} \
     ${SBUILD_CHROOT_PREINSTALL_EXTRA} \
-    libc6-dev:${DISTRO_ARCH} \
     fakeroot \
     build-essential \
     debhelper \
-- 
2.53.0

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20260724134749.1150268-1-felix.moessbauer%40siemens.com.

             reply	other threads:[~2026-07-24 13:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24 13:47 'Felix Moessbauer' via isar-users [this message]
2026-07-28 15:33 ` Zhihang Wei

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=20260724134749.1150268-1-felix.moessbauer@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=felix.moessbauer@siemens.com \
    --cc=jan.kiszka@siemens.com \
    --cc=wzh@ilbers.de \
    /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