Setup gtk4 in ubuntu 20.04

Hi Team,

I’d like to start contributing to GNOME development. However I’m facing issues while trying to install GTK4 on my 20.04. Most of the GTK dependencies’ versions are not available for Ubuntu 20.04 package manager. I was advised not use packages outside of synaptic.

So please let me know the right way to setup GTK4 and it’s dependencies. I would like to install GTK4 and it’s dependencies in the user space to build and run the app.

Thanks,
Arun

You can use flatpak as described here.
https://gtk-rs.org/gtk4-rs/stable/latest/book/installation_linux.html

@julian libgtk-4-dev isn’t available in ubuntu 20.04. Need to be compiled from source.

Flatpak doesn’t require you to install dependencies locally. They will be installed within a container (the flatpak). You just have to follow the guide.

Yes. but it’s creating a lot of boilerplate code which I’m not understanding.

If you use GNOME Builder, you can easily develop against runtimes shipped via Flatpak, or at least that’s my impression:

https://developer.gnome.org/documentation/introduction/flatpak.html

If the Builder on your platform is too old you can get a newer one from flathub.org

@michel Yes. But new project in builder is creating additional boiler plate code related to flatpak and meson. I rust want to run a bare bones application without flatpak and meson.

Maybe set up a docker container with a distro that has GTK4 and do your development from there if updating to a recent distro is not an option for you.

That’s just not possible. Cargo does not really support making GTK/Linux applications: you need desktop files; you need installing resources and assets in system paths; you need C dependencies.

There’s a reason why Meson and Flatpak exist.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.