[buildd-tools-devel] Bug#610689: sbuild: cross support

Hector Oron hector.oron at gmail.com
Fri Jan 21 12:09:55 UTC 2011


Package: sbuild
Version: 0.60.8-1
Severity: wishlist

Hello,

  I would love sbuild to gain the ability to handle cross builds. What is a cross build? Well, it is a way to generate a binary which it is meant to run on a foreign architecture. For cross builds you need cross tools, which are not yet in Debian archive, but those are available via emdebian.org repositories. So basically, you need to add
  deb http://emdebian.org squeeze main
into your sources.list, update and install, for example, linux-libc-dev-armel-cross, libc6-dev-armel-cross, gcc-4.3-arm-linux-gnueabi, ..
Once you got the cross toolchain in place, you can try to cross compile hello application passing -a$arch option to dpkg-buildpackage and the package must support cross building, usually by adding a three liner [0] to the package build system file.

(sid_amd64)zumbi at cat:/tmp/hello-2.6$ dpkg-buildpackage -us -uc -rfakeroot -aarmel
[...]
chown -R root:root debian/tmp
chmod -R u+w,go=rX debian/tmp
dpkg --build debian/tmp ..
dpkg-deb: building package `hello' in `../hello_2.6-1_armel.deb'.
 dpkg-genchanges  >../hello_2.6-1_armel.changes
dpkg-genchanges: including full source code in upload
 dpkg-source --after-build hello-2.6
dpkg-buildpackage: full upload (original source is included)

When trying sbuild to do it for me,

$ sudo sbuild -d sid_amd64 --debbuildopt="-aarmel" hello_2.6-1
[...]
chmod -R u+w,go=rX debian/tmp
dpkg --build debian/tmp ..
dpkg-deb: building package `hello' in `../hello_2.6-1_armel.deb'.
 dpkg-genchanges -B >../hello_2.6-1_armel.changes
dpkg-genchanges: arch-specific upload - not including arch-independent packages
dpkg-genchanges: binary-only upload - not including any source code
 dpkg-source --after-build hello-2.6
dpkg-buildpackage: binary only upload (no source included)
Build finished at 20110121-1105
Can't find hello_2.6-1_amd64.changes -- can't dump info
  Package contents
  Finished
Built successfully
Purging /srv/chroot/sid_amd64/build/root-hello_2.6-1-amd64-D9WaOO
Finished at 20110121-1105
Build needed 00:00:12, 4812k disc space

Sbuild builds the package but it is unable to take it out of the chroot, because it is unable to find the right changes file for the right architecture.
"Can't find hello_2.6-1_amd64.changes -- can't dump info"

Doing a $nasty hack on Build.pm we are able to follow *_armel.changes file.

$ sudo vi /usr/share/perl5/Sbuild/Build.pm +1944
# Figure out chroot architecture
sub chroot_arch {
    my $self = shift;
    my $nasty = "armel";
^^^^^
    my $pipe = $self->get('Session')->pipe_command(
        { COMMAND => [$self->get_conf('DPKG'),
                      '--print-architecture'],
          USER => $self->get_conf('USERNAME'),
          CHROOT => 1,
          PRIORITY => 0,
          DIR => '/' }) || return undef;

    chomp(my $chroot_arch = <$pipe>);
    close($pipe);

    die "Can't determine architecture of chroot: $!\n"
        if ($? || !defined($chroot_arch));

    return $nasty;
^^^^^
 #   return $chroot_arch;
}

It seems that sbuild triggers dpkg --print-architecture to find out chroot architecture, but when doing cross it should try to follow dpkg-architecture's DEB_HOST_ARCH.

Would it be possible to modify Build.pm in some way, either calling dpkg-architecture or autodetecting -a$arch has been passed and it should follow other architecture changes file?

Have a very nice day!

[0] http://wiki.debian.org/EmdebianGuide#Addingcross-builddetection

Best regards,
-- 
 Héctor Orón

-- System Information:
Debian Release: 6.0
  APT prefers unstable
  APT policy: (700, 'unstable'), (600, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages sbuild depends on:
ii  adduser                       3.112+nmu2 add and remove users and groups
ii  libsbuild-perl                0.60.8-1   Tool for building Debian binary pa
ii  perl                          5.10.1-17  Larry Wall's Practical Extraction 
ii  perl-modules                  5.10.1-17  Core Perl modules

Versions of packages sbuild recommends:
ii  debootstrap                   1.0.26     Bootstrap a basic Debian system
ii  fakeroot                      1.14.5-1   Gives a fake root environment

Versions of packages sbuild suggests:
pn  deborphan                     <none>     (no description available)
ii  wget                          1.12-2.1   retrieves files from the web

-- no debconf information





More information about the Buildd-tools-devel mailing list