GIMP Musings

Downloads

Previous articles

So You Want to Compile Gimp

The Groundwork

Building Gimp is not relatively straightfoward on Windows as it is on a Linux distribution. You have to do a lot of up front work to be able to accomplish this. In the following, I hope I am able to articulate clearly what you need and what kind of investigations and trial-and-error I had to do. Moreover, I will interlace the build process with both 64-bit and 32-bit. If a specific section is independent of this, it will not mention 64 or 32. In any case, if you have any questions, please feel free to drop me a line.

Collecting the necessary bits

Firstly, download the the mingw-gcc compiler and msys environment. For 64-bit compilation, I used the Sezero personal build and for 32-bit I used the daily build. I prefer to install the mingw-gcc compiler under c:\mingw64 for 64-bit and c:\mingw for 32-bit. Next install msys under c:\msys. Note that, if you download the gcc-compiler installer, then it will offer to install msys development environment as well. I would advise that you do that, but move msys\1.0 to c:\msys.

Next, you will need to install Python 2.7.1 and Perl since the Perl version that is included with msys does not include the XML parser and is older than the version required by Gimp. It is best to get Python 2.7.1 from the official distribution and Perl from ActiveState. I installed Python 2.7 at c:\Python27 and Perl on c:\Perl64 (c:\Perl under 32-bit). Next download and install Notepad++ which is what I use for all editing. Feel free to use any text editor or IDE that you are comfortable using.

You now have the basis for a functional Unix-style environment and you can use all your Unix knowledge in this environment. From this point, I will use forward slashes for directory as opposed to Windows style backslash. Note that foward slashes are perfectly valid in almost all situations under Windows. After installing Perl, I simply copied the whole Perl directory to the msys/opt directory.

Msys includes a batch file msys.bat that you can use to launch the bash shell. Verify that everything is working so far. That is, you have a functional shell and you can use Unix commands like "ls -alk", "df -h", etc. Finally, create an /opt directory in the root of your msys installation.

mkdir -p /opt/lib; mikdir /opt/bin;

Now you need to modify this environment to work on your computer.

Edit /etc/fstab and add the following:

C:\win32\mingw\    /mingw
C:\win32\src\    /usr/src
C:\win32\Python27    /usr/python
C:\win32\gtk    /usr/gtk

Change the directory structure to reflect where you installed the above. Verify your edits so that when you do

$ cat /etc/fstab

you get the above. Note that the src directory is where we will put our source codes so that they are all in one place.

Notice that we have not installed GTK+2.0 so far. Download the cross-built mingw GTK+ availabe from OpenSUSE. You must download these builds for GTK+-2.0 and GLIB. They will be in the Red Hat RPM format. Once you do that, use 7zip to unarchive these RPMs in c:\gtk.

From the GNOME binary/source website, download the following:

atk-dev_1.32.0-1_win32.zipatk_1.32.0-1_win32.zip
cairo-dev_1.10.2-1_win32.zip cairo_1.10.2-1_win32.zip
expat-dev_2.0.1-1_win32.zipexpat_2.0.1-1_win32.zip
fontconfig-dev_2.8.0-2_win32.zipfontconfig_2.8.0-2_win32.zip
freetype-dev_2.4.4-1_win32.zipfreetype_2.4.4-1_win32.zip
gdk-pixbuf-dev_2.22.1-1_win32.zipgdk-pixbuf_2.22.1-1_win32.zip
gettext-examples_0.18.1.1-2_win32.zipgettext-runtime-dev_0.18.1.1-2_win32.zip
gettext-runtime_0.18.1.1-2_win32.zipgettext-tools_0.18.1.1-2_win32.zip
gtksourceview-2.10.0.zipgtksourceview-dev-2.10.0.zip
intltool-0.40.6libiconv-1.9.1.bin.woe32.zip
libffi-dev_3.0.6-1_win32.ziplibffi_3.0.6-1_win32.zip
libxml2-dev_2.7.7-1_win32.ziplibxml2_2.7.7-1_win32.zip
pango-dev_1.28.3-1_win32.zippango_1.28.3-1_win32.zip
pixman-dev_0.20.0-1_win32.zippkg-config_0.25-1_win32.zip
zlib-dev_1.2.5-2_win32.zipzlib_1.2.5-2_win32.zip

Except for intltools, and libiconv I unzipped the others in the c:\gtk folder. I installed intltools and libiconv in /opt/lib. Be sure all the intltools point to the correct version of Perl at /opt/perl. You can modify these tools since they are simply shell script files. Make sure that the first line for intltool-merge, intltool-prepare, and intltool-update is something like

#!/opt/perl/bin/perl -w

Now, update the following variables - PATH, PYTHONPATH, and PKG_CONFIG_PATH in /etc/profile. I have the following:

export PATH=".:/opt/perl/bin:/opt/bin:/bin:/mingw/bin:c:/usr/gtk/bin:/usr/python"
export PYTHONPATH=/usr/python
export PKG_CONFIG_PATH=/opt/gimp-2.7.3/lib/pkgconfig:/opt/lib/pkgconfig:/usr/gtk/lib/pkgconfig:/usr/python/Lib/pkgconfig

Rerun msys.bat for the above to take effect. Then test your environment by running gtk-demo. It should produce a nice window with all its features. Run the command

gcc -v

to give you an idea of what version of gcc you have and how it was compiled. Finally, run the following command

pkg-config --modversion gtk+-2.0

This should produce 2.24.3 or higher to compile Gimp. If this command throws up an error, make sure you have configured PKG_CONFIG_PATH as above and you have followed the instructions so far.

Graphics Bits

Gimp needs a few graphics packages: JPEG, PNG, TIFF, and Little CMS. You can get the latest builds for JPEG, PNG, and TIFF from the GNOME binary website. Download the following zipfiles

jpeg-dev_8-1_win32.zipjpeg_8-1_win32.zip
libpng-dev_1.4.3-1_win32.ziplibpng_1.4.3-1_win32.zip
libtiff-dev_3.9.2-1_win32.ziplibtiff_3.9.2-1_win32.zip

Unzip each of the files into /opt.

I could not find a mingw build available for Little CMS from their website. So, download the source code to /src/graphics/. The do the following

tar xzf lcms-1.19.tar.gz

This will create the source tree for Little CMS. Now do your first compile. From here, I am going to assume that you have started the msys environment and that you are at a command prompt typically a "$". To compile lcms, change over to the lcms-1.19 directory, and do the following.

./configure --prefix=/opt CPPFLAGS="-I/opt/include -I/c/Python27/include" LIBS="-L/opt/lib -L/c/Python27/Lib"

For Windows 64-bit, execute the command

./configure --prefix=/opt --build=x86_64-w64-mingw32 CPPFLAGS="-I/opt/include -I/c/Python27/include" LIBS="-L/opt/lib -L/c/Python27/Lib"

Once configure finishes, do the following

make -j8; make -j8 install

I use j8 because my machine has 8 cores. So, you can run 8 jobs simultaneously. Adjust to your CPU.

That is all the groundwork needed to begin the job of compiling Gimp (I hope). If not, drop me a line.

Continue on to building Gimp....


If you wish to use the official version then Gimp 2.7.1 is available from here.

If you are inclined to leave a comment...

Your name:


Your email:


Your comments:


Return to Partha's home.