Open Source: Build and install GIMP from source code

GNU Image Manipulation Program is one of the best open source projects out there as an alternative for PhotoShop. This post discusses how we can build and install GIMP from source code. I did it because I wanted to contribute to the project.

August 29, 2014 - 3 minute read -
gimp open-source

GNU Image Manipulation Program is one of the best open source projects out there as an alternative for PhotoShop. I used it extensively for every graphic design purpose. It is natural that once you know the product very well, one starts finding possible improvements in the product. I had a few in my list and as a developer I thought why not build them myself. Hence the idea of building GIMP from source code, so that I can make changes to source and start developing.

What follows is a step-by-step guide to build GIMP from source. This guide is tested on Ubuntu 14.04 32 bit. It is suggested to use the most recent version of your distro.

Step 1:

Let’s create a directory where we will store all the clones or tar balls. Fire up the terminal and run the following commands. (I’d recommend not to close the terminal session until the installation is done)

mkdir -p ~/sourcefiles
cd ~/sourcefiles

Step 2:

Get the latest source code of GIMP from https://git.gnome.org/browse/gimp using one of the following commands.

git clone git://git.gnome.org/gimp

This might take few minutes depending on connection speed. Feed your pet by the time its cloned.

Step 3:

Now, you wouldn’t want GIMP you already have in your machine to interfere with the GIMP you’re going to install. So let’s set the path for the new GIMP.

prefix=/opt/gimp
export PATH=$prefix/bin:$PATH
export PKG_CONFIG_PATH=$prefix/lib/pkgconfig
export LD_LIBRARY_PATH=$prefix/lib

Step 4:

While compiling GIMP source code, you’ll need lot of GIMP development dependencies. So let’s install them first.

sudo apt-get build-dep gimp

This might take quite a while depending on connection speed. Go walk your pet in the meanwhile.

Step 5:

We also need babl and gegl packages before we start compiling GIMP source.

For babl:

cd ~/tmp
git clone git://git.gnome.org/babl
cd babl
./autogen.sh --prefix=$prefix
make
sudo make install

For gegl:

cd ~/tmp
git clone git://git.gnome.org/gegl
cd gegl
./configure --prefix=$prefix
make
sudo make install

Step 6:

Now we are ready to build GIMP from source.

cd ~/tmp/gimp
./configure --prefix=$prefix

Look out for any errors. You might be missing any dependencies or packages. Feel free to comment below if you face any difficulties and share how you solved it. I’ll append your comment in the Issues and Resolves section below. If you can’t figure out the resolve for your problem the GIMP community is always there to help. Join us on IRC. Server: GimpNet Channel: #gimp

Once it is compiled, run the following commands.

make
sudo make install

Time to test the product to make sure everything went well.

/opt/gimp/bin/gimp-2.9

Your version might be different according to the source. 2.9 was the latest source at the time of this writing. Welcome to the GIMP Developers’ community :)

Disclaimer:

This guide was meant for beginners and has been made easy using the following sources:

Issues and resolves:

The issues you might face solely depend on your system’s state. You might be missing libraries that the latest source of GIMP needs.sudo apt-get build-dep gimp installs the libraries that are needed by the stable version of GIMP. The latest source code of GIMP might require more.

I faced following issues while compiling GIMP 2.9:

  1. Missing gexiv2. This gnome wiki link should fix that. But make sure instead of ./configure --enable-introspection run ./configure --prefix=$prefix --enable-introspection
  2. While making the gexiv2 package, g-ir-scanner was missing. This can be solved by sudo apt-get install gobject-introspection

Welcome to the world of Open Source!

Evíva!