[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

WG: Speedup when using qemu to cross-build packages.



Hi Josh, hi Helmut,

again, many thanks for all the information. I feel quite a bit overwhelmed right now, but it really looks like very valuable pointers I would not have found by chance.

So far, I'm really quite a bit under shock w.r.t. how complicated it seems to be to get the remaining work done, but I certainly do understand why cross-building is essential for porting.

W.r.t the packages I've tried to build: I did the exercise today for Debian Bullseye, so maybe I would have had more success for Bookworm or even Sid?! Anyhow, this is what I did:

1) Get the list of basic source packages:
$ apt-cache show $(sudo debootstrap --arch=armhf --print-debs bullseye /tmp/be) | awk '$1~/^Package:/{n=$2} $1~/^Source:/{n=$2} /^$/{print n}' | sort -u

2) For each of these packages, I start a fresh docker container "FROM scratch", that I fill with the rootfs that I got from:
$ debootstrap --arch=amd64 --include="gpg.dirmngr.gpg-agent.ca-certificates.crossbuild-essential-armhf" --variant=buildd bullseye /tmp/amd64
Furthermore, I add the additional architecture ...
$ dpkg --add-architecture armhf 
... and the source packages:
echo "deb-src deb.debian.org/debian bullseye main" >>/etc/apt/sources.list && apt-get update

3) Finally, I run the following commands for each package, always starting with a fresh container instance as described so far:
$ apt-get build-dep --yes --host-architecture=armhf $package
$ apt-get source $package
$ cd ${package}* && DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage --no-check-builddeps --jobs=$(nproc) -us -uc --jobs-try=$(nproc) --build=binary --host-arch=armhf

When doing this, the following 54 packages successfully build: libtirpc shadow init-system-helpers p11-kit cdebconf libcap2 adduser nano apt debian-archive-keyring iptables libcap-ng sysvinit logrotate kmod cron tasksel libtext-charwidth-perl util-linux tar e2fsprogs libffi ncurses nettle elfutils less audit libseccomp tzdata acl libbsd pam libnftnl rsyslog cryptsetup findutils libedit liblocale-gettext-perl iputils base-passwd isc-dhcp sed sensible-utils slang2 grep netbase libnsl newt libbpf base-files coreutils libtext-iconv-perl readline iproute2

These 21 packages cannot install their build dependencies: apparmor bash bind9-libs cpio db5.3 debconf glibc gnupg2 gzip jansson krb5 libgcrypt20 libgpg-error libidn2 liblognorm libtext-wrapi18n-perl lsb lvm2 nftables systemd vim

And these 38 fail to build: mawk libsemanage gmp libmnl popt libxcrypt libsepol perl dpkg libzstd keyutils libmd gnutls28 debianutils openssl libfastjson pcre2 attr xz-utils argon2 xxhash hostname libtasn1-6 gcc-10 diffutils procps json-c libselinux libestr gcc-9 zlib bzip2 dash dmidecode lz4 pcre3 libunistring ifupdown

> > To me, the major problem is that cross-building seems to be not even a
> > second-class citizen to package maintainers: When cross-building only the
> > most basic packages, i.e. those being reported by "debootstrap
> > --print-debs", less than a third build sucessfully, the rest fail for various
> > reasons, many of them (e.g. bash, glibc, apparmor, ...) even fail already to
> > install their required build dependencies!
> Maybe you are not cross-building them correctly? How are you cross-building
> Debian packages? Above you say that less than a third cross-build successfully.
> I cannot confirm this observation. Using crossqa.d.n, the situation for the
> packages shown by debootstrap --print-debs is not too bad. The only source
> packages in that selection that never succeeded to cross-build in the last runs
> on crossqa.d.n are db5.3, gcc-12, libselinux, libsemanage and vim. So only five
> source packages out of your selection of 109.

So I exaggerated a bit: It's less than half (not less than a third) of the packages that successfully build (for bullseye). Besides building for bullseye instead of sid, is there any other obvious reason for the discrepancy?

Many thanks for your precious time,

Chris 



Reply to: