Building GIMP

This page describes how to build GIMP.

Prerequisites

You should know how to use:

  • a terminal and the command line;
  • shell environment variables.

GIMP’s dependencies

GIMP depends on quite a few libraries, including but not limited to:

  • GLib – a library used by many GNOME applications, containing utilities and common data structures for programs written in C.
  • GObject - a library for implementing objects (as in Object-Oriented-Programming) in C.
  • GTK – a graphical toolkit for building cross-platform user interfaces. GIMP 2.10 needs GTK+2 whereas GIMP 2.99 and later need GTK 3.0.
  • GExiv2 - a library for manipulating exif data (image metadata).
  • Cairo_(graphics) – a 2D graphics library, used for drawing some of GIMP’s widget and also used by Gtk+.
  • Python-Cairo: Python bindings for Cairo (not necessary anymore for GIMP 2.99 and later).
  • Pango – a library for laying out and rendering text, used also in Gtk+.
  • liblcms - the Little Color Management System, a library for working with color profiles.
  • libmypaint - a painting library that allows a lot of flexibility for brushes; it needs both libmypaint (the libmypaint-v1 branch) and mypaint-brushes (the v1.3.x branch).

GIMP’s core depends also on two libraries which are mainly (but not only) intended to be used with GIMP:

  • babl – a library for converting between pixel formats, heavily used by GIMP when communicating with GEGL.
  • GEGL – a graph based image processing library, heavily used in GIMP’s core.

Some of GIMP’s plugins depend on (at least) the following libraries

  • librsvg – a library for rendering SVG files.
  • libpng – a library for reading and writing PNG image files. Used by Gtk+, GIMP and GEGL.
  • libwmf - a library for working with WMF files.
  • libtiff - a library for reading and writing TIFF image files.
  • libjpeg - a library for reading and writing JPEG image files. This list is incomplete.

For more complete list of dependencies, see the files:

These text files are generated by our build system and contain up-to-date version information for dependencies. They are included in the root folder of source tarballs under the name INSTALL.

Build system

Preparing for Building

  1. You may need to install some software to build GIMP, including a C compiler, make, GNU autotools, meson, and more, plus many dependencies. See the OS-specific pages for details:
  1. Choose a place to install everything, and set a variable to point to it:

If you’re building GIMP from master, you may not want to install it in your system prefix, as you may break your system GIMP installation, or get odd behavior, especially if you also have a system version of GIMP installed.

You should then create another prefix directory where GIMP (and some dependencies) may be installed safely. On Linux you could use $HOME/.local. Let’s name your custom prefix :

 export GIMP_PREFIX=${HOME}/gimp_prefix
  1. Set some environment variables:

Some dependencies may be installed in this prefix too, so the build system should be able to find them :

 # Used to find programs/tools during build
 export PATH="${GIMP_PREFIX}/bin:$PATH"

 # Used to detect the build dependencies
 export PKG_CONFIG_PATH="${GIMP_PREFIX}/share/pkgconfig:${GIMP_PREFIX}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
 # Assuming a 64-bit build. Remove otherwise.
 export PKG_CONFIG_PATH="${GIMP_PREFIX}/lib64/pkgconfig:$PKG_CONFIG_PATH"

 # Used to find the glib-introspection dependencies
 export XDG_DATA_DIRS="${XDG_DATA_DIRS:+$XDG_DATA_DIRS:}${GIMP_PREFIX}/share:/usr/local/share:/usr/share"

 # Used to find the libraries at runtime
 export LD_LIBRARY_PATH="${GIMP_PREFIX}/lib:${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"

 # Used by Autotools to find its tools
 export ACLOCAL_FLAGS="-I $INSTALL_PREFIX/share/aclocal $ACLOCAL_FLAGS"

 # Used to find introspection files
 GI_TYPELIB_PATH="${GIMP_PREFIX}/lib/girepository-1.0:${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}"

Later, to run the GIMP you have installed outside the usual places, you also need some of these environment variables. If you intend to frequently run your self-built GIMP, you may want to set some of these environment variables in your profile (a shell script that sets environment variables when you login). In particular, you may want to set PATH and LD_LIBRARY_PATH, which affect runtime.

  1. For Debian or derivatives (Ubuntu, Mint…) only:

Additionally to the previous commands (not in replacement), update some variables this way if you use a Debian derivative:

  arch="$(dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null)"
  export PKG_CONFIG_PATH="${GIMP_PREFIX}/lib/${arch}/pkgconfig:$PKG_CONFIG_PATH"
  export LD_LIBRARY_PATH="${GIMP_PREFIX}/lib/${arch}:${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
  export GI_TYPELIB_PATH="${GIMP_PREFIX}/lib/${arch}/girepository-1.0:${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}"

Note: The "${var:+:$var}" syntax prevents a trailing ":" character in the variable, that may lead to issues (especially for LD_LIBRARY_PATH).

Download the source code

Download with git

This is preferred when working on the source code and developing GIMP.

 git clone https://gitlab.gnome.org/GNOME/babl.git
 git clone https://gitlab.gnome.org/GNOME/gegl.git
 git clone https://gitlab.gnome.org/GNOME/gimp.git

You can build specific versions by choosing a ‘’tag’’ (a fixed git revision)…

 # List available tags
 git tag
 # Update the working directory to a specific tag :
 git checkout GIMP_2_10_32

… or a ‘‘branch’’ :

 # List available branches
 git branch -a
 # Checkout a branch :
 git checkout gimp-2-10

Download release archives

GIMP also provides release archives. This is preferred when building stable releases.

Build the source code

babl and GEGL

Babl and GEGL use Meson. The build needs to be out-of-source, but the process is simple.

You can read the file meson_options.txt to find a list of options.

You may enable Link-time optimization (meson option b_lto) to have better performance.

 cd babl
 meson _build \
     --prefix=${GIMP_PREFIX} \
     --buildtype=release \
     -Db_lto=true

 cd _build
 ninja
 ninja install

Then repeat for GEGL.

GIMP

Finally, you’re ready to build GIMP!

For the stable branch (gimp-2-10 for GIMP 2.10.x versions), you must build with autotools.

For the unstable branch (master for GIMP 2.99 versions which will lead to future stable GIMP 3.0 branch), you can choose between Autotools and Meson. Note that meson is currently in intensive testing phase, and is recommended to packagers for bug reporting, in the process of becoming the next default build system. Yet the autotools build system still exist as fallback on master branch.

Autotools build

The steps are the very common historical build process, refered to as ./configure && make && make install, except that ./autogen.sh runs ./configure for you.

cd into the directory where you unpacked gegl.

If you’re building source you checked out from git, run:

 ./autogen.sh --prefix=${GIMP_PREFIX}

(assuming, as recommended, you have chosen to install outside the usual place, and defined environment variable GIMP_PREFIX)

This generates a configure script and then runs it.

If you’re building from a tarball, use configure instead of autogen:

 ./configure --prefix=${GIMP_PREFIX}

To see options you can configure:

 ./configure --help

(for a first build, it may be easier to accept the default build configuration, then later tweak the configuration in steps)

Then:

 make && make install

Note: it is also possible to build autotools out-of-tree, calling the configure script from another directory, i.e.:

 mkdir _build && cd _build
 ../configure --prefix=${GIMP_PREFIX} && make && make install

Meson build

You can configure the build with options.

Options for the meson build of GIMP are described in the repository file meson_options.txt . In the example below, the line -Dpython=true is one such option.

Meson itself also provides built-in options , such as :

  • warning_level=[1, 2, 3] : The level of compiler warnings
  • b_lto=true|false : Enable link-time optimizations
  • b_coverage=true|false : Enable coverage tools.
  • b_pgo=off|generate|use : Enable profile guided optimizations
  • b_sanitize=none|address|thread|undefined|memory|address,undefined : Use a code sanitizer
 cd gimp
 meson _build \
     --prefix=${GIMP_PREFIX} \
     --buildtype=release \
     -Dpython=true

 cd _build
 ninja
 ninja install

Useful build options

You can customize the directory where GIMP stores settings. This prevents any interference with other GIMP installations on the same computer.

  • Autotools build : –with-gimpdir=GIMP/git-master
  • Meson build : -Dgimpdir=GIMP/git-master

Problems?

Most problems will occur during the configure stage, and with any luck it’s just a missing package and the error message will make it clear what package you need. But there are more subtle problems that can occur. If you have a difficult error, look in: Problems and Solutions

Running Your New GIMP

You need to keep defined the same environment variables as for the build. You may want to define them in a script that you will source with :

 source ~/gimp_definitions.sh

To keep those variables contained only for the execution of GIMP, you may want to use subshells :

 (source ~/gimp_definitions.sh ; $GIMP_PREFIX/bin/gimp-2.10)

See the OS-specific pages for more specific advice: