Friday, February 27, 2015

Cross compiling armhf for Debian distribution (Qt5 and chroot)

This guide covers building Qt5 projects into armhf architecture .deb files for distribution.

Make Emulated Root Enviroment

First we want to make an emulated root environment to do all of our work in [1]. We need to get debootstrap and qemu-user-static to do this.

This will take a long time as we are building a new root filesystem of archetecture armhf in /chroots/sid-armhf. You may have noticed sid in a few places. This is debians unstable distribution. You could replace it with any other release found in:

Next we need to change our apparent root directory and mount the proc directory:

Create a /usr/sbin/policy-rc.d to prevent daemons from starting up inside the chroot:

And change the permissions to 775:

Finally modify the /etc/apt/sources.lst file to a proper repository for the root:
Then update and install the archive-keyring followed by another update of apt:

To reduce error messages about locales you may wish to install the locales package in the emulated root environment:

And then configure it selecting (assuming you are using US English):
I chose to use UTF-8 as the default locale.

Making a .deb from a Qt Project

This next portion focuses on creating a .deb file from a Qt project, following the steps outlined in [3] is recommended for a better understanding.

I have built a sample project to package which can be found here:

Clone the repo into helloworld-0.0.1 (do this somewhere smart like /home/username):

Next we need to install the proper packages for building the Qt project and .deb files:

Now we are ready to rock. To build the package (without source, if you want source follow the steps in [3]) run the script.

No comments:

Post a Comment