[PATCH 1/1] sbuild-chroot: fix incompatible dependency optimization

0 views
Skip to first unread message

Felix Moessbauer

unread,
Jul 24, 2026, 9:48:09 AM (21 hours ago) Jul 24
to isar-...@googlegroups.com, w...@ilbers.de, jan.k...@siemens.com, Felix Moessbauer
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.mo...@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

Reply all
Reply to author
Forward
0 new messages