This page describes how to build cross compilers for Ubuntu.

Oneiric

For current development version (11.10 'Oneiric') updating cross toolchain is easy and has few steps.

armel-cross-toolchain-base

This is first package which provides cross binutils, libc6 and libgcc.

  • grab source of armel-toolchain-cross-base: apt-get source armel-cross-toolchain-base

  • bump version in debian/changelog: dch -i

  • install all build dependencies: apt-get build-dep armel-cross-toolchain-base

  • do test build: debuild (or better: pdebuild to have it done on clean system)

    • keep build results - will be needed for gcc

  • generate final source package for upload: debuild -S

gcc-4.x-armel-cross

There are separate packages for each version: 4.4, 4.5, 4.6 but 4.4 is no longer supported by Linaro so can be skipped. Building of them is best to be done from git tree as there is a script which can be used to generate source packages for all 3 versions and two architectures (armel, armhf).

Preferred order of build:

  • grab source from git: git clone git://git.linaro.org/people/hrw/cross-toolchain-packaging.git -b gcc-4.x-cross

  • bump version in debian/changelog: dch -i

  • install all build dependencies: apt-get build-dep gcc-4.6-armel-cross

    • update system with updated versions from armel-cross-toolchain-base built before

  • do test build: debuild (or better: pdebuild to have it done on clean system)

  • generate source packages:

for arch in armel armhf;do
  for gcc in 4.4 4.5 4.6;do
    ./generate.sh $arch $gcc
  done
done
  • generate source packages for upload: debuild -S

  • do test build of all versions in pbuilder

Upload

After successful builds of armel-cross-toolchain-base and all supported GCC versions all what left is uploading packages into Ubuntu.

arm(el|hf)-cross-toolchain-base needs to be built with the same gcc-4.6 version as gcc-4.6-arm(el|hf)-cross version!!! otherwise packages will be not installable.

Armhf

Just repeat steps made for armel ;D

older releases

There is Linaro backport PPA which provides cross toolchain packages for older releases. Officially supported releases are:

  • 10.04 'lucid' LTS
  • 11.04 'natty'

10.10 'maverick' is not supported but providing packages for it is trivial.

preparing toolchain component packages

As there is a rule "do not break anything, do not replace existing packages other then cross toolchain" we have to prepare toolchain components a bit:

  • binutils
  • eglibc
  • gcc-4.5
  • gcc-4.6
  • linux

gcc-4.4 is not supported anymore - was provided in June/July 2011 due to being required as gcc-defaults-armel-cross 1.6 required packages in 'natty' versions to get rid of update-alternatives which were used in past to select default compiler version.

Patches for each component are available in git tree and are applied using quilt.

All those patched packages are expected to generate only COMPONENT-VER-source_all.deb packages (so they fail on amd64 and build only on i386 when they are sent to PPA). This is controlled by BACKPORT variable which is set by default in patched components.

build order

  • fetch package from development release: apt-get source COMPONENT

  • patch it with patches from git: QUILT_PATCHES=../git/COMPONENT quilt push -a

    • if any patch needs edit then use your quilt skills and push changes back to git
  • install all build dependencies: apt-get build-dep COMPONENT

  • change distribution to "lucid" ("maverick" for gcc-4.6)
  • do test build: debuild (or better: pdebuild to have it done on clean system)

  • generate final source package for upload: debuild -S

  • upload to PPA

Once they build for i386 (amd64 builds will fail cause there are no binary:arch packages) you can go to next step.

gcc-4.6 special case

As this component requires newer libraries then "lucid" has we build it only for "maverick" and "natty". For this we need few extra steps:

  • go to copy packages page in PPA

  • select "gcc-4.6" from lucid
  • copy it to "maverick"

building cross toolchain

This step is similar to "oneiric" part but there are few more steps to do. So let's repeat:

  • grab source of armel-toolchain-cross-base: apt-get source armel-cross-toolchain-base

  • change version in debian/changelog by adding "~ppa1": dch

  • enable PPA build: touch debian/ppa

  • do test build: DIST=lucid pdebuild

    • keep build results - will be needed for gcc

  • generate final source package for upload: debuild -S

  • upload to PPA

And then do the same for gcc-4.5 and gdb (if there were changes to it requiring build).

gcc-4.6 build order is same but "maverick" should be used.

testing cross toolchain

  • create "maverick" chroot: debootstrap maverick maverick http://archive.ubuntu.com/ubuntu

  • create "natty" chroot: debootstrap natty natty http://archive.ubuntu.com/ubuntu

  • add "lucid" PPA into both chroots
  • add "maverick" PPA into both chroots
  • install cross toolchain packages
  • test them: apt-get build-dep gpm;apt-get source gpm;cd gpm-*;dpkg-buildpackage -b -aarmel

If test works then copy them from "lucid" to "maverick" and "natty" (or from "maverick" to "natty" in case of gcc-4.6).


CategoryCrossCompile

MarcinJuszkiewicz/Projects/UbuntuCrossToolchains (last modified 2011-07-07 15:17:06)