Building and testing GTK

First make sure that you have the necessary external dependencies installed: pkg-config, Meson, Ninja, the JPEG, PNG, and TIFF libraries, FreeType, and, if necessary, libiconv and libintl. To get detailed information about building these packages, see the documentation provided with the individual packages. On any average Linux system, it’s quite likely you’ll have all of these installed already, or they will be easily accessible through your operating system package repositories.

Then build and install the GTK libraries in the order: GLib, Cairo, Pango, then GTK. For each library, follow the instructions they provide, and make sure to share common settings between them and the GTK build; if you are using a separate prefix for GTK, for instance, you will need to use the same prefix for all its dependencies you build. If you’re lucky, this will all go smoothly, and you’ll be ready to start compiling your own GTK applications. You can test your GTK installation by running the gtk4-demo program that GTK installs.

If one of the projects you’re configuring or building fails, look closely at the error messages printed; these will often provide useful information as to what went wrong. Every build system has its own log that can help you understand the issue you’re encountering. If all else fails, you can ask for help on the GTK forums.

© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk4/4.0/building.html