GNOME Builder¶
Note
It is assumed that you have already gone through the Setting up Flatpak for GNOME Development section to setup flatpak on your workstation.
GNOME Builder is an Integrated Development Environment (IDE) traditionally used for building GNOME applications. This guide will show you how to set up Builder in preparation for developing, building, and deploying app flatpaks to a phone shell environment.
It may be useful to refer to the GNOME Builder documentation for more detailed information about setting up and using the IDE.
Installing Builder¶
First, ensure that you have set up Flatpak as described in ref:flatpak_setup_gnome. This enables installation of up-to-date versions of Builder.
At the command line, run flatpak
to install the latest version of GNOME Builder on the stable branch:
$ flatpak install flathub org.gnome.Builder
You may be asked to confirm installation. Once installed, you can run Builder in the following way:
$ flatpak run org.gnome.Builder
You can later update the stable version of Builder using this command:
$ flatpak update org.gnome.Builder
See the Managing Flatpaks guide for an overview of commands for installing, updating and uninstalling flatpaks.
Setting up QEMU on Debian-Based Systems¶
Since Builder relies on statically linked qemu binaries for cross-building, you will either need to run an OS that provides these for you (like Fedora, Debian Buster, or PureOS) or fix up your Debian Stable workstation to enforce static linking before starting Builder. Manually fixing Debian qemu binaries (setting flags: F) is required until a patched version of qemu is distributed by your OS. Without statically linked qemu binaries, you will not be able to build an installable armhf or aarch64 flatpak from Builder.
To perform these operations, you will need to be the root
user (sudo is not good enough).
You can first check what the flags are set to for qemu-arm and then perform a similar operation to see the flags for qemu-aarch64:
$ cat /proc/sys/fs/binfmt_misc/qemu-arm
enabled
interpreter /usr/bin/qemu-arm-static
flags: 0C
offset 0
magic 7f454c4601010100000000000000000002002800
mask ffffffffffffff000000000000000000feffffff
Since this is a proc file, it can’t simply be edited in a standard editor so you will need to remove the information from binfmt’s register and replace it.
qemu-arm:
$ echo -1 > /proc/sys/fs/binfmt_misc/qemu-arm
$ echo ":qemu-arm:M:0:\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfe\xff\xff\xff:/usr/bin/qemu-arm-static:F" > /proc/sys/fs/binfmt_misc/register
$ cat /proc/sys/fs/binfmt_misc/qemu-arm
enabled
interpreter /usr/bin/qemu-arm-static
flags: F
offset 0
magic 7f454c4601010100000000000000000002002800
mask ffffffffffffff000000000000000000feffffff
qemu-aarch64:
$ echo -1 > /proc/sys/fs/binfmt_misc/qemu-aarch64
$ echo ":qemu-aarch64:M:0:\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-aarch64-static:F" > /proc/sys/fs/binfmt_misc/register
$ cat /proc/sys/fs/binfmt_misc/qemu-aarch64
enabled
interpreter /usr/bin/qemu-aarch64-static
flags: F
offset 0
magic 7f454c460201010000000000000000000200b700
mask ffffffffffffff00fffffffffffffffffeffffff
Further Reading¶
The GNOME Builder documentation contains more in-depth information about all aspects of the IDE.
See the Building and Deploying an Application with GNOME Builder tutorial for a practical guide to building and deploying a flatpak on a development board.