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

Re: Creating debs using a cross-build environment?

On Fri, 24 Feb 2012 08:23:20 +0100
Svante Signell <svante.signell@telia.com> wrote:

> If I succeed with a cross build, it would be nice to get a .deb package
> to copy to the target box and dpkg -i there! 

dpkg-buildpackage -a$arch

> Populating sysroot is not
> important, except for creating files to install on the target box if deb
> creation is not possible. To me debootstrap and multistrap are creating
> a (target) base system for use in a chroot. That wouldn't work cross-OS
> would it, at least without copying the files to the target and reboot
> into the target?

The output of debootstrap or multistrap needs to be unpacked onto the
appropriate device, the packages then need to be configured on-device.
That can happen in a chroot if there is a secondary way to boot the
device (initrd etc.). That way, both debootstrap and multistrap can and
do work cross-architecture.

Having a .deb doesn't help you there, it still needs to be configured
(especially for libraries) and configuration cannot happen
cross-architecture because it involves executing the foreign
architecture binaries on the final system.

> > > With cross-build dpkg-support:
> > > ==============================
> > > Set up where the cross tools and target headers, libraries and
> > > executables are located.
> > > cd package
> > > That will create .debs to be installed on the target box or in $SYSROOT.
> > 
> > Actually, not all packages support cross compilation, you might need
> > to check, proper way would be by setting -a$ARCH flag. So,
> >   dpkg-buildpackage -b -ahurd-i386 (+extra flags)
> Haven't tried yet. How is the cross-build environment found by
> dpkg-buildpackage?

debian/rules can contain some explicit support, packages using
autotools will generally pick up --build and --host, compilers use
other commands like --target. A lot of packages use pkg-config which
itself is normally handled by the toolchain / supporting packages like

Don't do thing MultiArch yet for cross-compilation, it isnt't ready.
Use the old dpkg-cross method using a frontend like xapt to install all
the foreign architecture packages as -$arch-cross packages. Use the -m
option to xapt to cope with the currently incomplete MultiArch


Neil Williams

Attachment: pgpEQfVpIWqR0.pgp
Description: PGP signature

Reply to: