Bug#801799: pbuilder: please support cross building

Helmut Grohne helmut at subdivi.de
Wed Oct 14 16:37:05 UTC 2015


Package: pbuilder
Severity: wishlist

Hi Mattia,

thanks for your work on pbuilder and your interest in making it work for
cross building as well. As discussed with you, this bug is supposed to
serve as an implementation plan to make pbuilder support cross building.

The first part to supporting cross building is to extend the user
interface in a way exposing the functionality. This implies
distinguishing the "build" architecture from the "host" architecture.
Currently pbuilder only knows about one architecture given via
--architecture. The documentation of this option needs clarification
which architecture(s) it refers to. Furthermore pbuilder needs a means
to select a host architecture that differs from the build architecture.
Unless the --architecture switch is to be interpreted as host
architecture and the build architecture is taken from the base.tgz, a
new option is required here. Defaults should be picked such that the
build architecture and the host architecture coincide as native building
still is predominant.

Internally, pbuilder should probably start differentiating those two
architectures and expose them via shell variables, so internal functions
and hooks can refer to them. When doing cross-specific things, pbuilder
should not carry a boolean to determine whether a cross build is in
operation, but instead use an equality test on the build and host
architectures. I am mentioning this here, because debomatic got this
wrong initially.

During a cross build, pbuilder should dpkg --add-architecture the host
architecture in the chroot (unless the chroot already has that
architecture added).

The dependency resolver needs to make use of the host architecture.  In
the simplest case, the experimental apt comes to unstable and all you
have to do is pass --host-architecture to "apt-get build-dep foo.dsc".
When using pbuilder's internal resolvers, things look less bright. It is
not clear to me, whether making those resolvers cross-aware is worth the
effort.

Unless apt takes care, pbuilder should install
crossbuild-essential-$DEB_HOST_ARCH before satisfying Build-Depends. In
a distant future, this might turn out unneeded, but for now and stretch
this is how things will be done.

Next, dpkg-buildpackage as invoked by pbuilder needs to be told about
the host architecture. Maybe other tools (such as dpkg-checkbuilddeps)
also need such awareness.

I think that everything beyond the dependency resolver change can be
implemented without waiting. To test the result (without a working
dependency resolver), you can create a special base.tgz that already has
crossbuild-essential-$somearch installed and build a package with
trivial cross dependencies. Examples are: attr base-files bzip2 dash
db-defaults debianutils diffutils findutils gdbm gmp gzip hostname
keyutils kmod libatomic-ops libelf libpthread-stubs libseccomp libsepol
libtextwrap libunistring libxau libxdmcp mawk openssl patch pcre3
tcltk-defaults ustr xz-utils

I hope that this covers most things, but in the interest of getting
things right, I X-Debbugs-Cced d-cross at l.d.o so those who disagree can
easily follow up.

Helmut



More information about the Pbuilder-maint mailing list