-
-
Notifications
You must be signed in to change notification settings - Fork 404
Tips & Tricks
To debug a flatpak application, these steps might be helpful:
- Install the SDK, for example with
flatpak --user install gnome-nightly org.gnome.Sdk
. This is needed to have debug symbols. Omit the--user
flag and change the repo if necessary. - Install the debugging symbols for the application you want to debug. These are in ”runtime extensions”, which by convention have
.Debug
appended to their name. So the debug info for org.gnome.Recipes is in the org.gnome.Recipes.Debug extension - Open a flatpak debug shell, for example with sh:
flatpak run -d --command=sh org.gnome.Gitg
. You might want to choose a different shell or start a different application. - In this shell, run
gdb gitg
(replacegitg
with the application you chose in step 3).
flatpak-coredumpctl
is a helper script to debug coredump files of crashed flatpak applications.
If you're using flatpak-builder and some module mysteriously fails to build, you can get a shell in the build tree by using:
host $ flatpak-builder --run appdir org.my.Manifest.json sh
sh-4.3$ cd /run/build/failed-modulename
Now you're in a shell with the build directory and can start debugging the failure.
Note: Only the failed module build directory will be there to look at. If you specify --keep-build-dirs
to flatpak-builder you can also see the other build dirs.
If you've just built an application and want to test it, you don't have to export the appdir to a repo and then install it. Instead you can use flatpak build appdir bash
to get a shell in the application, so you can test it.
Note: This will be a typical "build" environment, so the app may not have access to all the permissions it requests. If you need these you have to manually specify them again. If you're using flatpak-builder to
build the app you can use the flatpak-builder --run
helper which will automatically call flatpak build
with all the finish-args that your manifest specified, except filesystem ones.
You can (for testing) run an application with a different runtime than it typically uses. For instance, to run stable gedit with the latest unstable gnome runtime you can do:
flatpak run --runtime-version=master org.gnome.gedit
You can also use a completely different runtime (but same version number):
flatpak run --runtime=org.gnome.Sdk org.gnome.gedit
Note: If you just want to use the sdk instead of the platform like the above, a better approach is to use -d
.
It is possible to install an older build of an application (or runtime).
First you look for the commit you are interested in:
flatpak remote-info --log flathub org.gnome.Recipes
Then you deploy the commit:
flatpak update \
--commit=ec07ad6c54e803d1428e5580426a41315e50a14376af033458e7a65bfb2b64f0 \
org.gnome.Recipes
Flatpak repositories can easily host builds for multiple architectures. An interesting case is hosting both x86_64 and i386 builds in the same repository. Since it is very easy, here are the steps to do it:
Make sure you have the i386 version of the sdk installed:
flatpak install gnome org.gnome.Sdk/i386/3.24
Build your application like before, but add --arch=i386 to the flatpak-builder invokation:
flatpak-builder --force-clean --repo=repo --ccache \
--arch=i386 \
--gpg-homedir=gpg --gpg-sign=${RELEASE_GPG_KEY} \
--from-git=git:https://git.gnome.org/recipes --from-git-branch=master \
recipes flatpak/org.gnome.Recipes.json
Note that you only need to call flatpak build-update-repo once, after building all architectures:
flatpak-builder --force-clean --repo=repo --ccache \
--gpg-homedir=gpg --gpg-sign=${RELEASE_GPG_KEY} \
--from-git=git:https://git.gnome.org/recipes --from-git-branch=master \
recipes flatpak/org.gnome.Recipes.json
flatpak-builder --force-clean --repo=repo --ccache \
--arch=i386 \
--gpg-homedir=gpg --gpg-sign=${RELEASE_GPG_KEY} \
--from-git=git:https://git.gnome.org/recipes --from-git-branch=master \
recipes flatpak/org.gnome.Recipes.json
flatpak build-update-repo --generate-static-deltas \
--gpg-homedir=gpg --gpg-sign=${RELEASE_GPG_KEY} \
repo
Note that if you use --require-changes when doing several builds for different architectures from the same git commit, you may see some scary git output in the log about 'detached HEADs' - those are safe to ignore here.
If you want to install locales for other languages that the one you are using, it is possible to add extra language with the following command:
flatpak config --set extra-languages "nb;nn;fr"
Replace the value with a semi-colon separated list of the language codes you want to have installed.
Then update with flatpak update
. If the languages are not installed. It will automatically download extra languages. This does not uninstall removed languages.
For more details: https://docs.flatpak.org/en/latest/flatpak-command-reference.html#flatpak-config
Visit flatpak.org for information on getting started, developer documentation and details of available applications and runtimes.