CrossCompile

Cross-Compiling Mir with sbuild

This document attempts to collect issues around cross-building the Mir/Unity stack with sbuild. It is not a guide to sbuild, for that please see SimpleSbuild.

Explicit G++ Dependency

In order to prevent accidental C++11 ABI breaks, each component in the Mir/Unity tree is tagged with an explicitly versioned G++ dependency. Unfortunately to cross build, for example from build amd64 to host armhf we need the packageg++-arm-linux-gnueabihf:amd64. You can see a detailed discussion on the debian wiki. In the mean-time a workaround of deleting the dependency is necessary and is fine except at G++ release time.

$ (src/mir): sed "/g++-4.9/d" debian/control
$ (src/mir): bzr bd -S --native -- -uc -us

I (~racarr) am using a simple script to apply build source packages and prevent me from accidentally applying this change.

Prepopulating build-dependencies

sbuild documentation suggests that it should be possible to prepopulate a source chroot as such:

$ schroot -c source:utopic-amd64-armhf -u root
$ apt-get -aarmhf build-dep mir

unfortunately this will fail due to the G++ versioning issue. An appropriate list of packages for Mir amd64->armhf compile as of 23rd September 2014 is available here (can be copy pasted to apt-get install in source chroot).

Targeting RTM

I (~racarr) am yet to succesfully create a direct to rtm schroot. However it's possible to update an existing chroot. The step involving pulling the signing key from a phone is weird...hope someone has a better solution.

# Copy rtm apt-signing key in to chroot
$ adb hell
$ apt-key export 5810338B > /tmp/apt-rtm.gpg
$ exit
$ adb pull /tmp/apt-rtm.gpg /var/lib/schroot/chroots/utopic-amd64-armhf
# In chroot
$ schroot -c source:utopic-amd64-armhf -u root
$ apt-key add /tmp/apt-rtm.gpg
$ echo "deb http://derived.archive.canonical.com/ubuntu-rtm/ 14.09 main restricted" >> /etc/apt/sources.list
$ echo "Package: *
Pin: release n=14.09
Pin-Priority: 10000" >> /etc/apt/preferences
$ apt-get update
$ apt-get dist-upgrade

The GPG key can be imported from the keyserver rather than the phone:

$ gpg --recv-keys 5810338B
$ gpg --armor --export 5810338B > /var/lib/schroot/chroots/utopic-amd64-armhf/tmp/apt-rtm.gpg

Mir/CrossCompile (last edited 2015-01-29 17:59:34 by robru)