Before you can compile the GTK widget toolkit, you need to have various other tools and libraries installed on your system. Dependencies of GTK have their own build systems, so you will need to refer to their own installation instructions.

A particular important tool used by GTK to find its dependencies is pkg-config.

pkg-config is a tool for tracking the compilation flags needed for libraries that are used by the GTK libraries. (For each library, a small .pc text file is installed in a standard location that contains the compilation flags needed for that library along with version number information.)

Some of the libraries that GTK depends on are maintained by the GTK team: GLib, GdkPixbuf, Pango, and GObject Introspection. Other libraries are maintained separately.

  • The GLib library provides core non-graphical functionality such as high level data types, Unicode manipulation, and an object and type system to C programs. It is available from here.

  • The GdkPixbuf library provides facilities for loading images in a variety of file formats. It is available here.

  • Pango is a library for internationalized text handling. It is available here.

  • GObject Introspection is a framework for making introspection data available to language bindings. It is available here.

  • The GNU libiconv library is needed to build GLib if your system doesn’t have the iconv() function for doing conversion between character encodings. Most modern systems should have iconv().

  • The libintl library from the GNU gettext package is needed if your system doesn’t have the gettext() functionality for handling message translation databases.

  • The libraries from the X window system are needed to build Pango and GTK. You should already have these installed on your system, but it’s possible that you’ll need to install the development environment for these libraries that your operating system vendor provides.

  • The fontconfig library provides Pango with a standard way of locating fonts and matching them against font names.

  • Cairo is a graphics library that supports vector graphics and image compositing. Both Pango and GTK use Cairo for drawing. Note that we also need the auxiliary cairo-gobject library.

  • libepoxy is a library that abstracts the differences between different OpenGL libraries. GTK uses it for cross-platform GL support and for its own drawing.

  • Graphene is a library that provides vector and matrix types for 2D and 3D transformations. GTK uses it internally for drawing.

  • The Wayland libraries are needed to build GTK with the Wayland backend.

  • The shared-mime-info package is not a hard dependency of GTK, but it contains definitions for mime types that are used by GIO and, indirectly, by GTK. gdk-pixbuf will use GIO for mime type detection if possible. For this to work, shared-mime-info needs to be installed and XDG_DATA_DIRS set accordingly at configure time. Otherwise, gdk-pixbuf falls back to its built-in mime type detection.