Building GIMP for Windows

The main GIMP building instructions are at Building GIMP. This page is for Windows-specific additions.

Supported Windows API

The supported versions of Windows are noted in the devel-docs/os-support.txt file in the respective branches:

GIMP project is favoring backward compatibility as a general rule and we really don’t like deprecating hardware (unfortunately often associated to OS version, sometimes for no good reasons, sometimes on purpose by vendors) when it is just a few years old. Nevertheless we may have to bump our Windows requirement when it becomes too hard to maintain both old and new APIs.

Copying our Continuous Integration scripts

Since our CI for the development branch include Windows builds, and that we try to keep this build as full-featured and up-to-date as possible (because it is here to warn us of any new issue), a good practice could be to look at the .gitlab-ci.yml file and the gitlab-ci folder in our repository.

We have 2 pipelines for Windows:

  • For native MSYS2 compilation, you should look at deps-win-x64 for the compilation of babl and GEGL and at gimp-win-x64 for others deps and GIMP.
  • For cross-compilation on Debian Testing for Windows, you should look at the image-win-x64-cross job for dependencies to install on Debian from its package manager, at deps-win-x64-cross for the ones we build and install ourselves with crossroad and at gimp-win-x64-cross for compilation of GIMP with crossroad.

Running the build-deps and build-gimp scripts by these jobs might be all there is to do for you. To better understand the compilation flow, you may read below.

Building GIMP natively under Windows using MSYS2

MSYS2 is a POSIX environment with basically everything you would find on a Linux system (shell, package manager, GCC…). It allows to use POSIX tools to build Windows software.

Setting up the environment

  1. First, follow the installation instructions for MSYS2 available at msys2.github.io or simply run, in PowerShell (Win 10 and +), winget install --id=MSYS2.MSYS2 -e.
  2. To open a terminal, you need to execute clangarm64 (for 64-bit ARM, unstable branch only), mingw64 (64-bit x86) or mingw32 (32-bit x86).
  3. Update the system :
 pacman -Syyuu
  1. If the shell tells you to close the terminal, close it and run again. That is a normal procedure.

Install the dependencies for GIMP

Dependencies are installed with the following command:

Stable branch (GIMP 2.10) dependencies

pacman -S --needed \
    git \
    base-devel \
    ${MINGW_PACKAGE_PREFIX}-toolchain \
    ${MINGW_PACKAGE_PREFIX}-asciidoc \
    ${MINGW_PACKAGE_PREFIX}-drmingw \
    ${MINGW_PACKAGE_PREFIX}-gexiv2 \
    ${MINGW_PACKAGE_PREFIX}-gettext-tools \
    ${MINGW_PACKAGE_PREFIX}-ghostscript \
    ${MINGW_PACKAGE_PREFIX}-glib-networking \
    ${MINGW_PACKAGE_PREFIX}-graphviz \
    ${MINGW_PACKAGE_PREFIX}-gtk2 \
    ${MINGW_PACKAGE_PREFIX}-gobject-introspection \
    ${MINGW_PACKAGE_PREFIX}-iso-codes \
    ${MINGW_PACKAGE_PREFIX}-json-c \
    ${MINGW_PACKAGE_PREFIX}-json-glib \
    ${MINGW_PACKAGE_PREFIX}-lcms2 \
    ${MINGW_PACKAGE_PREFIX}-lensfun \
    ${MINGW_PACKAGE_PREFIX}-libheif \
    ${MINGW_PACKAGE_PREFIX}-libraw \
    ${MINGW_PACKAGE_PREFIX}-libspiro \
    ${MINGW_PACKAGE_PREFIX}-libwebp \
    ${MINGW_PACKAGE_PREFIX}-libwmf \
    ${MINGW_PACKAGE_PREFIX}-meson \
    ${MINGW_PACKAGE_PREFIX}-mypaint-brushes \
    ${MINGW_PACKAGE_PREFIX}-openexr \
    ${MINGW_PACKAGE_PREFIX}-poppler \
    ${MINGW_PACKAGE_PREFIX}-python2-pygtk \
    ${MINGW_PACKAGE_PREFIX}-SDL2 \
    ${MINGW_PACKAGE_PREFIX}-suitesparse \
    ${MINGW_PACKAGE_PREFIX}-xpm-nox
  • $MINGW_PACKAGE_PREFIX is defined internally by MSYS2.

Unstable branch (GIMP 2.99) dependencies

pacman -S --needed \
    git \
    base-devel \
    ${MINGW_PACKAGE_PREFIX}-toolchain \
    unstable deps list

Since the unstable deps list is large and updated quite frequently, you need to copy it from all-deps-uni.txt file.

Then simply hit enter at the prompts for which packages to install (default=all). This step will download a ton of packages, and may take a while.

Building the software

You can now just follow the instruction on the main page Building GIMP. Just be careful of the following changes:

  • Avoid enabling b_lto while calling meson.

You may want to disable the docs while building babl and GEGL:

  • Disable docs for babl: -Dwith-docs=false while calling meson.
  • Disable docs for GEGL: -Ddocs=false while calling meson.

Do the same while building GIMP and, since you are using two prefixes (the gimp and msys one), disable the relocatability to avoid errors:

  • meson build : -Dg-ir-doc=false -Dgi-docgen=disabled -Drelocatable-bundle=no
  • autotools build : --disable-docs --disable-relocatable-bundle

Once built, you can run GIMP through the arch-specific shell of MSYS. To open via Windows Terminal, you need to add the prefixes to PATH in ‘Environment Variables’.

Cross-Compiling GIMP under UNIX using crossroad

A tool named crossroad has been developed to cross-build for Windows under Linux (it was even originally started to crossbuild GIMP specifically and is used until today in our CI builds).

Once installed, here is the schematization of the process:

crossroad source msys2
crossroad install DEPENDENCIES_HERE
crossroad w64 gimp --run="MESON_HERE.sh"

Check out the .gitlab-ci.yml, 1_build-deps-crossroad.sh and 2_build-gimp-crossroad.sh for more details on how crossroad works.

Note that GObject-Introspection build (unstable branch only) is very hard when cross-compiling so it is usually disabled as an exception when a cross-compilation is detected. It is the only missing feature (GObject-Introspection is what allows bindings for plug-ins, such as Lua, Python, Script-Fu, Vala…). Yet some people manage to build the GObject-Introspection files, e.g. using yocto, which is why the meson configuration flag -Dcan-crosscompile-gir=true allows you to force Introspection.

Building GIMP using Microsoft tools

Microsoft Visual Studio comes with its own C compiler know as MSVC. Most of GIMP development is done with GCC or Clang.

Unfortunately both are not fully compatible, so integrating GCC, for example, into the Visual Studio build chain has its flaws, even while it might work in some points.

Because of this you are recommended to use compilers provided by MSYS2 for building GIMP on Windows. Eventually we are for more genericity and are therefore not against a build working on more compilers or tools. If you wish to contribute fixes to make GIMP build with Microsoft VS, then maintain the build so that it continues working, you are welcome to contribute.

Packaging third-party GIMP plug-ins for Windows

Users on the Windows and macOS platforms expect software to be packaged in a self-installing file (an installer). Even though GIMP plug-ins (whether scripts in Python or Scheme, or executables in the C language) are relatively easy to install, you might want to package them using an installer such as Inno Setup.