How to export GTK app for Raspberry pi os with Gnome Builder (my opereting system is ubuntu)

259 Views Asked by At

I want to make app for raspberry pi. I chosed gtk for gui library because it has a good looking ui and it is free. But i have 1 problem with it: i don't know how to export simple app that will work on raspberry pi. I have raspberry pi zero.

2

There are 2 best solutions below

0
Teipekpohkl On BEST ANSWER

GNOME Builder supports automagic cross compiling when using flatpak (it is also really simple with cli flatpak-builder). It also supports adding extra sysroots for non-flatpak cross compilation.

But if you are using flatpak, you should install and setup deviced on the raspberry pi https://gitlab.gnome.org/chergert/deviced. And have qemu-user-static (usually named like that on distros) installed on the computer you are compiling on. Then you can simply select the device enter image description here, accept it on the raspberry pi, it will automatically download the SDK. Then click the run button and it will run on the raspberry pi.

Note that compilation will be quite slow as flatpak emulates a native arm compiler instead of using a compiler that compiles to arm, but the compiler itself is x86.

1
Andrej Prsa On

What you're trying to do is cross-compiling. In order to do that, you need to set up an appropriate toolchain. Here is the link to the relevant discussion on SO on how to achieve that.

That said, it might be more trouble than it's worth. I have 3 ARMs and I mount them locally via sshfs (fuse). That enables me to edit/develop as if the files were local to my system (i.e. using my ubuntu environment). I only compile remotely, via an ssh session.