How to build GIMP 2.7.5 using MinGW in Windows 32-bits


As part of my work to implement OpenCL in GEGL and GIMP, I have to compile it for Windows, and it’s no easy task. I’ll describe here the step-by-step how to build GEGL and GIMP from Git.

Maybe this post can help people trying to compile GIMP and help developers to improve GIMP building process in Windows.

Install MinGW and MSYS

First, use mingw-get-inst to install the latest MinGW and MSYS, choose to install C/C++ compilers and the basic development environment. Install them in the default path.

After that, open the mingw shell and install wget, openssl and unzip, so we can download things from the command-line:

$ mingw-get.exe install msys-wget
$ mingw-get.exe install msys-openssl
$ mingw-get.exe install msys-unzip

Installing Perl

Perl is used by many building scripts. Download and install ActivePerl.

Now, let’s create our build directory:

$ mkdir /opt

Copy the whole content of Active Perl folder to this new folder [C:\MinGW\msys\1.0\opt].


Let’s create the folder where our GIMP will be:

$ mkdir /opt/gimp

Here the fun begins, we have to go to many places to find gtk+ precompiled binaries.

First, download from the GNOME ftp the GTK+ all-in-one bundle, it has many of the libraries we need.

$ cd /opt/gimp
$ wget
$ unzip

But, ATK, GLib and GTK+ versions bundled are too old for the latest GIMP. So we get them from OpenSUSE repository:

$ cd /opt/gimp
$ wget
$ wget
$ wget
$ wget
$ wget
$ wget

No easy way to extract them in MSYS, so go to the directory and extract it using 7zip. Replace files when asked. EDIT: Remember to move /bin, /usr, etc in packages (e.g: opt\gimp\usr\i686-w64-mingw32\sys-root\mingw) to your build dir!


Download these packages from GNOME ftp and unzip them in /opt/gimp

$ wget
$ wget
$ wget
$ wget

Environment variables

Before compiling anything, set these variables:

export PATH=".:/opt/perl/bin:/opt/bin:/bin:/mingw/bin:c:/opt/gimp/bin"
export PKG_CONFIG_PATH=/opt/gimp/lib/pkgconfig:/opt/lib/pkgconfig

Also, try to run gtk-demo to see if everything is ok:

$ gtk-demo.exe

A window should appear. If it complains about some dll missing, go to the GNOME ftp or the OpenSUSE repository, get it and install it in /opt/gimp.


Get Intltool source and let’s install in /opt

$ cd /opt
$ wget
$ tar -xzvf  intltool-0.40.6.tar.gz
$ cd  intltool-0.40.6
$ ./configure prefix=/opt
$ make ; make install

Little CMS

Download lcms 1.19 source and move it to /opt/src.

$ tar -xzvf lcms-1.19.tar.gz
$ cd  lcms-1.19
$ ./configure --prefix=/opt/gimp
$ make ; make install

Now, go to /opt/gimp/lib/pkgconfig. Here are all pkg-config files that will be needed to compile BABL, GEGL and GIMP. It’s very boring, but change all paths in them [prefix=] to /opt/gimp. You can use some script like:

find * -type f -name '*.pc' -exec sed -i "s#/devel/target/\(.*\)#/opt/gimp#g" {} \;

But change it to catch all pkg-config prefix formats in the folder.


Now you can get the latest packages directly from Git or from the nightly builds site.

$ cd /opt/src/babl-0.1.7
$ ./configure –prefix=/opt/gimp
$ make ; make install


$ cd /opt/src/gegl-0.1.9
$ ./configure --prefix=/opt/gimp CPPFLAGS="-march=pentium -mtune=pentium" --disable-docs
$ make ; make install


Finally, GIMP! In this tutorial I didn’t enabled Python for simplicity. In I fixed some errors about undefined prototypes, so give a look if your source includes it.

$ cd /opt/src/gimp-2.7.5
 $ ./configure --prefix=/opt/gimp CPPFLAGS="-march=pentium -mtune=pentium" --disable-python
 $ make
 $ make install

Now, there will be some errors probably:

  • If you have an error about “Undefined GetUserDefaultUILanguage”, change line 50 in app/language.c:
//switch (GetUserDefaultUILanguage())
switch (GetUserDefaultLangID())
  • I don’t know why, but my libintl doesn’t export some symbols like libintl_printf, so I had to put “#define libintl_printf printf” in the beginning of the following files:
    • app/core/gimptagcache.c
    • plug-ins/common/animation-play.c
    • plug-ins/common/curve-bend.c:
    • plug-ins/common/file-xwd.c
    • plug-ins/common/jigsaw.c
    • plug-ins/common/newsprint.c
    • plug-ins/common/sample-colorize.c
    • plug-ins/file-sgi/sgi.c
  • if you have many errors with Little CMS, change lines 22-26 of modules/display-filter-lcms.c. Don’t really know why:
//#ifdef G_OS_WIN32
//#define STRICT
#include <windows.h>

Now, go to /opt/gimp/bin and the gimp executable should be there. As we installed everything in /opt/gimp, just compress this folder if you want to create an installer or use it in another PC.


This entry was posted in Uncategorized. Bookmark the permalink.

23 Responses to How to build GIMP 2.7.5 using MinGW in Windows 32-bits

  1. Thanks Victor!
    I will try it.
    As you know, there are some limitations in our country network, we call it Great Firewall(GFW),
    So have to use VPN to access the site.

    Thanks a lot!

  2. Aeroshot says:

    My AVG protection found Trojan horse Generic26.BWEP, Generic26.BWNW,and Generic26.BXCV in File: “C:\MinGW\msys\1.0\opt\src\lcms-1.19\conftest.exe” 😥

    • Aeroshot says:

      After some searching AVG seems to have some history finding Trojans in conftest.exe’s during their short life in a ./configure operation.
      I can’t figure out how to get the babl 0.1.7 and gegl 0.1.9 though, site seemed to be down or something.

      • Victor Oliveira says:

        Weird, It’s down for me too.
        You can get it in the git repositories also, or wait a little. It should be back soon 🙂

  3. Aeroshot says:

    It’s back.Thanks Victor.
    I’m getting a babl configure error about the pkg-config script with advice about environment variables.
    I looked in …\opt\gimp\lib\pkgconfig\babl.pc and the part at the beginning (prefix=/opt/gimpexec_prefix=$ …) didn’t have the long alpha-numeric like the others (prefix=/opt/gimp…/alpha-numeric…exec_prefix=$ …)
    I don’t know if babl didn’t install properly or what.
    I think this is the closest I’ve gotten to compiling gimp in windows ;).
    any help is appreciated :).

  4. Victor Oliveira says:

    Hi Aeroshot!

    First, it’s strange that Babl fails because it has few dependencies. Anyway, all your .pc files should have:


    So, if you have anything else, replace for it (that’s what the script line tries to do).

    Moreover, remember to set the environment variables I said in the post. You can type “pkg-config –list-all” to see what packages pkg-config can see.

    Tell me if this works.

  5. Aeroshot says:

    Ok.I got time to come back to this. So. I didn’t realize I needed to set the environment variables again after re-opening the MinGW shell. Of course, it made sense once I thought about it. So the ./configure operation works well now (besides ‘usable jpeg library not found’).
    Thx again Victor :).

    Now it’s the gegl ‘make’ operation that seems to have problems:
    libtool: link: warning: ‘c:/mingw/lib/’ seems to be moved
    libtool: link: warning: ‘C:/MinGW/msys/1.0/opt/gimp/lib/’ seems to be moved
    This seems to show up for each library file.
    I don’t know if this is what keeps it from compiling, though. Any thoughts?

  6. Victor Oliveira says:

    I also get some of these errors. I think it has to do with MinGW having it’s own version of libintl.
    But these are warnings. Just give a look at the last compilation line, the exact error should be there.

  7. Aeroshot says:

    Ok. with ‘make’, the line just before ‘compilation terminated’ says:
    In file included from png-load.c:35:0:
    C:/MinGW/msys/1.0/opt/gimp/include/libpng14/png.h:397:18: fatal error: zlib.h: No such file or directory
    So I’m missing the zlib header?

  8. Victor Oliveira says:

    It seems so! Try to download zlib from the OpenSUSE repo.

    If this doesn’t work. Well, It is a bad practice, but why don’t you just copy the zlib.h header to C:/MinGW/msys/1.0/opt/gimp/include/libpng14 and see what happens?

    • Victor Oliveira says:

      Also, you can use the CFLAGS environment variable to point to the directory where zlib is.

      For example:

      $ export CFLAGS=-I/usr/include

  9. Aeroshot says:

    I found the zlib.h and “export CFLAGS=-I/opt/gimp/include” seemed to work.

    Now in gimp-2.7.4 folder, configure:error: Test for GLIB failed. The last check said:
    checking for GLIB – version >= 2.30.2… no
    A search for ‘glib’ just found files/folders labeled as version 2.0 or 2.28.2, even though I downloaded mingw32-glib2-2.30.2-1.22.noarch.rpm from openSUSE.

  10. Victor Oliveira says:

    See what “pkg-config –modversion glib-2.0” outputs. If it’s an older version, maybe you installed it wrong (decompress inside /opt/gimp) or there are conflicting files, if that’s the case maybe it’s better to wipe out the directory and start again.

  11. Aeroshot says:

    pkg-config says glib is version 2.28.8

    Something that seemed odd to me was that atk, glib and gtk+ don’t overwrite anything when I extract them into /opt/gimp and they go into several folders all within this path:
    opt\gimp\usr\i686-w64-mingw32\sys-root\mingw (namely; bin, etc, include, lib, share)

  12. Victor Oliveira says:

    That`s it 🙂
    You should move the content in opt\gimp\usr\i686-w64-mingw32\sys-root\mingw to opt\gimp.
    I forgot to say in the post.


  13. Aeroshot says:

    Woot! that seems to be it.

    Though, now it says GTK+ – version >=2.24.7… no
    yet, pkg-config –modversion gtk+-2.0 says 2.24.8.
    A popup says conftest couldn’t run because libffi.dll couldn’t be found.
    The console message says it usually means that the runtime linker is not finding GTK+, or finding the wrong version. then suggests changing LD_LIBRARY_PATH or /etc/ to point to the correct one.

  14. Aeroshot says:

    Yay! I’ve gotten as far as your errors section during the make ; make install.
    Not sure what I did, besides re-do-ing a lot of the steps, but it seems to compile now. I did try doing it Partha’s way when I got that last error, then went back to putting all the gtk stuff back in opt/gimp and changing the files in pkg-config folder from prefix=/usr\i686-w64-mingw32\sys-root\mingw to prefix=/opt/gimp.I also downloaded some libraries from Partha’s list, like libffi and used Partha’s configure style.

  15. Leet says:

    Have a problem while compiling GIMP 2.8 RC1.

    I followed these instructions exactly. When ./configure GIMP, it says “Your intltool is too old. You need intltool 0.40.1 or later”. I checked with intltool 0.40.6 and 0.41.1, but both without success… Can you help?

    • Leet says:

      Same issue if I try to compile GIMP 2.7.5, so it seems that my building environment is somehow messed up… :/

  16. Victor Oliveira says:

    Sometimes this can happen, try to clean your build and try again.
    Some libraries requirements have been updated in GIMP 8RC1, but I don’t remember which ones :/

    • Leet says:

      Thanks for your reply, I’ll try to rebuild it again later. Do you have a working build of GIMP 2.8RC1 for Windows and would you like to share it?

  17. linda says:

    I used with gegl-0.2.0.tar.bz2,there always have a error of “undefined referencr to ‘_fullpath'”.Could you help me?

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s