Re: Creating debs using a cross-build environment?

Neil Williams <[email protected]>
Newsgroups gmane.linux.debian.devel.embedded
Message-ID <[email protected]>
On Fri, 24 Feb 2012 08:23:20 +0100
Svante Signell <[email protected]> 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
> > > DEB_BUILD_GNU_TYPE=$BUILD DEB_HOST_GNU_TYPE=$TARGET dpkg-buildpackage -b
> > > 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
dpkg-cross.

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
transition.

-- 


Neil Williams
=============
http://www.linux.codehelp.co.uk/
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk9HSzYACgkQiAEJSii8s+NcfACgxkLJ5tTVP2pVMauaeTM7e0ZP
eYMAn2wP2W+f6nfQk/fetlJDUJtvXgvB
=KTG9
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.