I want to build a “hello world” app for mobile linux using GTK4.
On my x86_64 laptop with my hello.c, I was able to include gtk4, compile with gcc, and run the application. The window appeared and functioned correctly. Great! However, now I want to run the app on my phone.
I moved hello.c to my Raspberry Pi to build it there, since it shares the same architecture with my pinephone (aarch64), but I do not see libgtk-4-dev available in apt. I suppose I could try building GTK from source on the Pi, but that seems like it might be overkill for trying to compile a “hello world” program. But is that what I should do? Is anyone else using an easy method to compile GTK4 apps for mobile linux?
You probably need to check what version of the operating system you have on your Pi and whether that is a version that is expected to contain the needed support.
Why do this on a Pi? Why not do it on the Librem 5 itself? (or the PinePhone)
I am not a expert for native programming but I think you should cross-compile meaning compiling to different target architectures/platforms. In this case to x86_64 and go aarch64. Lookup the options gcc offers. There should be something. I don’t know if it can build for both targets in one run. Maybe a build tool like make can help organizing builds.
This way you can use your laptop for development and build and finally transfer the binary to the phone.