Building Glimpse/Windows

From GlimpseWiki
Jump to navigation Jump to search

This page contains instructions specific to building the Glimpse source code locally on Windows systems.


Please note that we only support 32-bit builds of Glimpse Image Editor for production use. The instructions below can be adapted to make a "native" 64-bit Windows build, but it will be missing useful 32-bit components and supporting dependencies.

Build with MSYS2

  1. Download MSYS2 from and then run the installer.
  2. Follow any other instructions presented on that download page to ensure key components managed by pacman are updated.
  3. Install the prerequisite build packages, selecting "default=all" when prompted. Replace w64 with w32 if you are running 32-bit Windows:
  4. pacman -S git base-devel \
    mingw-w64-i686-toolchain \
    mingw-w64-i686-asciidoc \
    mingw-w64-i686-drmingw \
    mingw-w64-i686-gexiv2 \
    mingw-w64-i686-ghostscript \
    mingw-w64-i686-glib-networking \
    mingw-w64-i686-graphviz \
    mingw-w64-i686-gtk2 \
    mingw-w64-i686-python2-pygtk \
    mingw-w64-i686-iso-codes \
    mingw-w64-i686-json-c \
    mingw-w64-i686-json-glib \
    mingw-w64-i686-lcms2 \
    mingw-w64-i686-lensfun \
    mingw-w64-i686-libheif \
    mingw-w64-i686-libraw \
    mingw-w64-i686-libspiro \
    mingw-w64-i686-libwebp \
    mingw-w64-i686-libwmf \
    mingw-w64-i686-openexr \
    mingw-w64-i686-poppler \
    mingw-w64-i686-SDL2 \
    mingw-w64-i686-suitesparse \
    mingw-w64-i686-vala \
    mingw-w64-i686-xpm-nox \
    mingw-w64-i686-meson \
  5. Add the necessary environment variables in the C:\msys64\home\$USERNAME\.bash_profile file (omit ACLOCAL_FLAGS on 32-bit Windows):
  6. export PREFIX=`realpath ~/prefix`
    export PATH="$PREFIX/bin:$PATH"
    export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig:$PREFIX/share/pkgconfig:$PKG_CONFIG_PATH"
    export XDG_DATA_DIRS="$XDG_DATA_DIRS:$PREFIX/share:/usr/local/share/:/usr/share/"
    export ACLOCAL_FLAGS="-I/c/msys64/mingw32/share/aclocal"
  7. Reload your session with the environment variables you just set:
  8. source ~/.bash_profile
  9. Follow the build steps outlined in Building Glimpse, but append --prefix=$PREFIX to the end of each ./ and ./configure command.
  10. The final Glimpse build step also needs the --disable-python flag to be set because of an upstream documentation bug:
  11. ./ --prefix=$PREFIX --disable-python
    make && make install

Once the build is complete, you should be able to launch the application by typing glimpse into the same MSYS2 MinGW window. Your settings will be saved in the %appdata%\Glimpse folder by default.

Run MSYS2 from Visual Studio Code

  1. Install the Shell launcher extension and follow the provided instructions to set a keyboard shortcut for it.
  2. Navigate to File > Preferences > Settings > Extensions > Shell Launcher configuration and click on any link to edit settings.json.
  3. Add "" and the editor should autocomplete so the file looks similar to this (it will vary depending on which components you have already installed on your computer and your IDE settings):
  4. {
        "": [
                "shell": "C:\\Windows\\System32\\cmd.exe",
                "label": "cmd"
                "shell": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
                "label": "PowerShell"
                "shell": "C:\\Program Files\\Git\\bin\\bash.exe",
                "label": "Git bash"
                "shell": "C:\\Windows\\System32\\bash.exe",
                "label": "WSL Bash"
  5. Now add a new entry to the JSON array pointing at the MSYS2 shell executable path. Replace MIGW32 with MINGW64 if you're building for 64-bit Windows:
  6. {
        "shell": "C:\\msys64\\usr\\bin\\bash.exe",
        "label": "MSYS2",
        "args": ["--login", "-i"],
        "env": {
            "MSYSTEM": "MINGW32",
            "CHERE_INVOKING": "1",
            "MSYS2_PATH_TYPE": "inherit"

    Omit the MSYS2_PATH_TYPE variable if you do not want to inherit the PATH from the wider system.

  7. You should now be able to invoke the MSYS2 shell by using your keyboard shortcut and selecting it from the drop-down list.
  8. Visual-studio-code-screenshot.jpg


Package with WiX Toolset

These instructions will package the code as a 32-bit Windows MSI installer. To build the code first, follow the directions provided in the HACKING file.

  1. Install the WiX toolset and ensure the %WIX% environment variable has been set.
  2. Create a folder in this directory called InputFiles32
  3. Copy the contents of your 32-bit build folder to InputFiles32
  4. Copy the LICENSE file to InputFiles32\LICENSE.TXT
  5. Copy the contents of C:\msys64\mingw32 to InputFiles32
  6. Replace every Guid="YOUR-GUID-HERE" with your own GUID values
  7. Navigate to the directory this file is in using a command prompt window and run the following commands:
    "%WIX%bin"\candle.exe Glimpse32.wxs
    "%WIX%bin"\light.exe Glimpse32.wixobj

    The component versions in Glimpse32.wxs may differ from your own, so you will need to update those appropriately.

You will be pleased to know that we do not include the whole of MinGW inside the MSI file! The WiX build tools just pick out the dependencies we have determined that Glimpse needs to function through a combination of experimentation and guesswork.

To test your new installer: From a command prompt in the same directory as this file, you can test your MSI installer with logging enabled. The first line works for most cases, but you may want to use the second line if you need more verbose output:

msiexec /i Glimpse32.msi /l* Glimpse32.log
msiexec /i Glimpse32.msi /l*v Glimpse32.log

To uninstall Glimpse Image Editor without having to go through the Add/Remove Programs control panel area:

msiexec /x Glimpse32.msi