Gimp Building Tips (for Linux)

This is an old version. The latest version is here: Gimp Building Tips (for Linux).

Updated for Ubuntu Natty Narwhal and GIMP 2.7 as of December 2011. For an earlier version, see gimpbuild-2009. Note: I haven't tested this on Lucid in a while -- may no longer work. The Natty instructions are up to date.

For building GIMP 2.7 on Mac, see Tim Chen's page: Build GIMP on Mac.

For building GIMP 2.7 on Windows, see How to build GIMP 2.7.5 using MinGW in Windows 32-bits.

GIMP has a fair number of dependencies, which can seem intimidating the first time you try to build it. Although configure is usually clear about what's missing, that's not always helpful in figuring out what package you need to add on a particular distro. The git instructions might also be helpful to anyone who hasn't used git very much yet.

If you want to build the latest GIMP but also keep another version, like the one from your distro, it's very important to include the --prefix argument when running autogen.sh or configure. Otherwise GIMP will end up installed to /usr/local/bin and all of your GIMP versions may get confused about which set of libraries applies to which binary. You may also want a wrapper script (see below) to set up the library paths appropriately.

Building GIMP from git on Ubuntu Natty

Natty has most of the dependencies, but you'll still need to get glib-2.30.2, as well as the git versions of babl and gegl. On Lucid or Maverick, you'll also need recent versions of the other packages like gtk, cairo and friends (see below).

Install GIT and other build dependencies

Install the GIMP build dependencies:

sudo apt-get build-dep gimp libglib2.0-0 libtool ruby
(note: ruby is needed for the gegl build if you're building from git).

Depending on what options you want, you might also want some other packages, such as: libopenraw1 libopenraw-dev libgexiv2-dev libgexiv2-0 graphviz libgraphviz-dev

Install GIT. You might think the package named "git" would be the right one, but don't bother with it -- on Ubuntu Lucid it just installs some documentation, not the actual git program. (This seems to have changed in Natty.)

sudo apt-get install git-core git-doc git-email
I installed "git-doc" and "git-email" too, though they're probably not needed.

Configure git (this comes from GitDevelopers on Gnome Live):

git config --global user.name "Your Name"
git config --global user.email you@host

Set up your install prefix

Decide on where you're going to put the installed files. By default, the packages will install to /usr/local, but that will cause conflicts with the older version of GIMP already installed on your machine. If you want to keep two or more GIMP versions available, you need to choose an install "prefix". For example, I use /usr/local/gimp-git. It's okay to put all the gimp-related packages in one prefix -- you don't need a separate prefix for each package.

If you're building on a system used only by you, you might want to consider using a prefix in your home directory, e.g. --prefix=/home/yourname/gimp-git. That way, you can run make install without needing to be root (in that case, omit the sudo in the lines below).

Set up your PKG_CONFIG_PATH to point to this prefix, otherwise gegl won't be able to find babl and gimp won't find either one of them. The easiest way to do this is to create the prefix, create a share directory inside it, then create a config.site file there containing lines like these:

export PKG_CONFIG_PATH="/usr/local/gimp-git/lib/pkgconfig:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="/usr/local/gimp-git/lib:$LD_LIBRARY_PATH"
If you choose, you can also set options like CFLAGS, ACLOCAL_FLAGS, etc.

Download the prerequisites

As of December 2011 and Natty, GIMP needs

which you can get from the GTK.org download page, You'll also need:

Oddly, gdk-pixbuf comes from a different place from gtk and glib:
gdk-pixbuf 2.22.1

The configure message for pango is confusing:

checking for PANGOCAIRO... no
configure: error: Test for PangoCairo failed.
Don't be fooled -- the problem isn't the cairo version support, it's just that it wants exactly version 1.24.4 (not 1.24.5, unless you're running a 2.31 development release of glib). But it doesn't bother to tell you any of that.

Pango comes from a GNOME download page. Don't be fooled by the mssage saying you

If you want SVG support and web page support for the help files, you'll have to build librsvg 2.34.2 or greater and libwebkit 1.6.1 or greater. Configure won't bother to tell you that if your versions are too low; it'll just disable those options and not tell you why.

Earlier releases

On earlier distros, like Maverick and Lucid, you may also need a recent cairo, from the Cairo releases page.

One problem: these versions of cairo and pixman have a circular depdency bug: the cairo build requires pixman.h installed, but pixman requires cairo.h. Try installing cairo-devel (this will be an earlier version of cairo, not the one you actually need for GIMP, but it seems to be enough to keep pixman happy); or try copying cairo.h from the cairo source into $prefix/include before building pixman.

Build the prereqs

All these packages are build the same way:

$ tar xvf filename.tar.bz2 (or gz)
$ cd dirname
$ ./configure --prefix=/usr/local/gimp-git
    (or your choice of prefix)
$ make
$ sudo make install

If you have a modern multi-core system, adding a -jN flag to the make line will speed things up. Try make -j4. (People argue incessantly about the best number to use after -j, but it seems to vary from one system to the next. It's not critical.)

The only trick is that you have to do them in the right order. The order seems to be: glib, pixman, cairo, gdk-pixbuf, gtk, babl, gegl, pango, gimp.

However, on some systems there's a circular dependency where pixman requires include files from cairo and cairo requires include files from pixman, and neither will install its include files if the other isn't there first. I don't know how to get past this besides manually installing the specific .h files it's looking for.

Then you're ready to start checking out the git versions of the GIMP-specific packages.

Check out the GIMP-related packages

You'll need babl and gegl as well as gimp. Here's how to get all three:

git clone git://git.gnome.org/babl
git clone git://git.gnome.org/gegl
git clone git://git.gnome.org/gimp
Or if you have a Gnome developer account:
git clone ssh://user@git.gnome.org/git/babl
git clone ssh://user@git.gnome.org/git/gegl
git clone ssh://user@git.gnome.org/git/gimp

Configure (autogen.sh) and build

Now build everything. The first time, you'll need to run autogen.sh in each directory and specify your prefix and any other configure options you might want. Later, when you update with git pull, you can just type make and make will re-run configure with the proper prefix.

cd babl
./autogen.sh --prefix=/usr/local/gimp-git
make
sudo make install

cd ../gegl
./autogen.sh --prefix=/usr/local/gimp-git
make
sudo make install

cd gimp
./autogen.sh --prefix=/usr/local/gimp-git --disable-gtk-doc
(review all the "no" answers and decide if you need to install anything else and re-run autogen. Installing libwebkit-dev won't help you get gimp-help, though; it wants a much newer version than what Jaunty has.)
make
sudo make install

Done! Your new gimp should be in /usr/local/gimp-git/bin/gimp.

Wrapper script

One more thing: if you have a distro-installed GIMP too, you may find it helps to have a wrapper script that ensures you're using the right libraries. Otherwise, GIMP and any plug-ins it runs can get confused and exhibit weird behavior.

Here's the script I use, which I install in ~/bin/gimp-git, and then I make a link to it named gimptool-git. I'm sure this could be improved, but it seems to work.

#!/bin/sh

progname=$(basename $0)
if [ $progname = 'gimptool-git' ]; then
  progname=gimptool-2.0
fi

GIMPLOC=/usr/local/gimp-git
export PATH=$GIMPLOC/bin:$PATH
export LD_LIBRARY_PATH=$GIMPLOC/lib

$GIMPLOC/bin/$progname $*

Older distros and older GIMP versions

If you're building an old tarball on an older Linux distro, you might want gimpbuild-2009 or even older gimp building instructions.


My book: Beginning GIMP, from Novice to Professional
Linux Imaging
General Linux links
Shallow Sky home
...Akkana