compiling gimp 2.8.2 from source in linux

The GNU Image Manipulation Program has just turned awesome with its single window mode in v2.8. That, and a host of other improvements, make it a “must-have” in any photo editor’s desk. However, just like most current linux software, there is no straightforward installation of v2.8.x for those of us who do not fancy a new operating system every 6 months; in the linux ecosystem, if we have made the OS customized to our needs and concentrate on actual work, we are a minority.

If you have Ubuntu 12.04 upwards, you need just 3 lines of code to install Gimp 2.8 via the terminal. For the rest of us, we need to install it from scratch because PPAs are not available.

My intention in this post and a similar (to be followed) is to create a reference for building the essential image editors required for any photographer using Linux. In this post, we’ll compile Gimp 2.8.2 with some essential libraries/ plugins. To elaborate on essentials, for example, Gimp out-of-the-box doesn’t come with EXIF support. Anyone would know how critical it would be to preserve exif data when an edited image is exported as JPEG.

Gimp is a large application, therefore has many dependencies. It is crucial to install it first in a separate standalone location that doesn’t affect the system. But perhaps a bigger advantage is that this creates a portable version, that can simply be copied and reused (in another machine, or in case of OS re-installation).

This how-to is for Debian ecosystem, and it was tested on Linux Mint 12 (Lisa) updated as on 08/31/2012. It should apply to other derivatives of Ubuntu 11.10 as well. For 10.04, see footnote.

A. Building dependencies system-wide:
We’ll build some dependencies at system-level because most of these libraries are also crucial for other image editing software, so it is a good idea to have them at /usr partition. While we are at it, I have also included dependencies for image formats and color management. These are useful if we also want to install a RAW editor like RawTherapee/ UFRaw. Because in the Debian ecosystem, apt-get will not make it more complex, just a little bit more download.

mint-user # sudo apt-get install build-essential cmake mercurial libgtk2.0-dev
libgtkmm-2.4-dev libtiff-dev libpng-dev libjpeg-dev liblcms-dev libiptcdata-dev \
liblcms2-dev pkg-config intltool fontconfig libfreetype6 libbz2-dev libjasper-dev \
libgs-dev libcurl4-gnutls-dev libgudev-1.0-dev git-core libtool python-gtk2-dev \
python-dev libffi gmic icc-profiles glew-utils libtiff-opengl

Here, we have covered the following dependencies mentioned in the GIMP Install file:

pkg-config, intltool
lcms, libpng, libjpeg, libtiff, libbzip2, libgs (Ghostscript), libjasper
PyGTK

The rest are more specific to Gimp, so we install in the standalone location along with Gimp, only to be used by Gimp.

B. Building dependencies for GIMP:
We need to download the following source tarballs. It is easier to keep track of them if downloaded in one location. Let us create a folder structure as below (replace user with your username, or use a different location as convenient):

mint-user # mkdir /home/user/portableApps/gimp2.8/gimp2.8.2 && \
cd /home/user/portableApps/gimp2.8/gimp2.8.2
mint-user # mkdir build
mint-user # mkdir src && cd src
mint-user # pwd
/home/user/portableApps/gimp2.8/gimp2.8.2/src

Once these directories are created, we can specify the PKG_CONFIG_PATH and LD_LIBRARY_PATH locally, that will be used to compile and link in this portable location:

mint-user # export PKG_CONFIG_PATH=/home/user/portableApps/gimp2.8/gimp2.8.2/build/lib/pkgconfig
mint-user # export LD_LIBRARY_PATH=/home/user/portableApps/gimp2.8/gimp2.8.2/build/lib

1. Download the following tarballs in this src folder.

Extract the tarballs inside src directory either by Right-click > Extract Here in the file explorer or from terminal:

mint-user # pwd
/home/user/portableApps/gimp2.8/gimp2.8.2/src
mint-user # tar -xvf tarball.tar.bz2

where tarball is the name of source tarball.

2. Install the following tarballs: (pwd is just a means to check the src directory)

babl

mint-user # pwd
/home/user/portableApps/gimp2.8/gimp2.8.2/src
mint-user # cd babl-0.1.10
mint-user # ./autogen.sh --prefix=/home/user/portableApps/gimp2.8/gimp2.8.2/build
mint-user # make
mint-user # make install
mint-user # cd ../

glib

mint-user # pwd
/home/user/portableApps/gimp2.8/gimp2.8.2/src
mint-user # cd glib-2.32.1
mint-user # ./configure --prefix=/home/user/portableApps/gimp2.8/gimp2.8.2/build
mint-user # make
mint-user # make install
mint-user # cd ../

For the rest, ref. steps for glib but inside the respective tarball-extracted directories (i.e. gegl-0.2.0 directory for gegl etc.)
gegl
atk
pango
gdk-pixbuf
pixman
cairo
gtk+
libexif

C. Compiling and Installing Gimp
Now comes the easiest part (but also the longest compilation time):

mint-user # pwd
/home/user/portableApps/gimp2.8/gimp2.8.2/src
mint-user # cd gimp-2.8.2
mint-user # ./configure --prefix=/home/user/portableApps/gimp2.8/gimp2.8.2/build
mint-user # make
mint-user # make install
mint-user # cd ../

If you have followed the steps all through, then with very high probability you have completed Gimp installation without errors and with the most essential features.

The last one downloaded (exif-browser) is a plugin to view exif data within Gimp. It is optional, but I find it very useful. It can be installed by the ./configure, make and make install sequence (with the right prefix as shown for glib).

D. Running Gimp:
Navigate to /home/user/portableApps/gimp2.8/gimp2.8.2/build/bin in file explorer and double-click on gimp-2.8 executable. Or in terminal:

mint-user # pwd
/home/user/portableApps/gimp2.8/gimp2.8.2/src
mint-user # cd ../build/bin
mint-user # ./gimp-2.8 &

It is easier to create a shortcut on the desktop. Simply point the command of shortcut to

/home/user/portableApps/gimp2.8/gimp2.8.2/build/bin/gimp-2.8

and it can be opened directly from desktop.

The second part of the series will continue with RAW editors, Luminance HDR and Picasa 3.9 on Linux.

P.S. For Ubuntu 10.04 or its derivatives, here is an excellent detailed article on building a standalone Gimp 2.8. My article is mostly influenced from it.

8 thoughts on “compiling gimp 2.8.2 from source in linux

  1. Hi i am running linux mint (maya) , It’s working properly , Thank you bro, Please post me the cross build of gimp to windows -64bit .

    Thanks

  2. and when space is a premium on smaller UFD how not-fast would it be to mount an NFS share from a mint13 box with gobs of space.. to run gimp

    assume 84megabit ethernet. no gigabit for us

    1. 84 megs should be good enough for accessing over a network.

      If you install in your favorite location rather than system defaults, all you need to do is ensure your paths are set correct.

      the steps above are for manual install of gimp – targeted for those who want to mix ingredients rather than use packaged stuff. Also, in my experience if you don’t have some dependencies required by a ppa, you end up doing loads of manual install anyway.

      Btw, AFAIR I could not run this ppa in my box. Are you sure it includes all dependencies?

  3. how does this differ ultimately from the widely popular

    ppa:otto-kesselgulasch/gimp
    or less so
    ppa:noobslab/ppa-gimp

    in terms of what has been installed?

    I was curious to install from source for the novelty of the experience but the interation through B2 seems tedious. If I was bash savvy.. well I probably wouldn’t need a stepwise guide 🙂

  4. Thank you very much. that worked fine for debian sid.
    However I still have performance issues with gimp when some part of an image is selected. It doesn’t matter how small the selection is or what tool was used to select. The processor load goes up to almost 100%. I can still work, but it is incredibly slow. The processor load remains high even after several ours doing nothing. Except of that, the performance is just fine. I’ve hoped they would have fixed that in 2.8.2.

    1. Norbert,

      I am running Linux Mint, supposedly more resource-intensive than Debian. I tried doing Unsharp Mask on a 28 megapixel tiff image (110 MB). It took about a minute, and the memory usage reached 650 MB. But I guess that is normal for such huge images (my machine is 3.5 yrs old Dual Core, 1.8 GB RAM). For smaller images, I find performance to be about the same as Picasa on Wine.

      But I agree that compared to previous releases, the selection tool is a little slow, and sometimes you are left with the box from an earlier selected size (which goes away if you invoke any other tool, say levels).

      I would suggest you email the Gimp users’ mailing alias, providing your machine/ OS details. If they can reproduce the problem, I am sure they will fix it asap.

      Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s