Difference between revisions of "Windows"

Line 104: Line 104:
Run CMake and Make:
Run CMake and Make:
<pre style="white-space: pre-wrap">
<pre style="white-space: pre-wrap">
$ make install
$ make install

Revision as of 00:37, 28 January 2017

This guide documents how to build RawTherapee for 32-bit or 64-bit versions of Windows using the MinGW-w64 runtime. Begin by installing and updating MSYS2 using the instructions from the MSYS2 website. Then run the following commands using either "MinGW-w64 Win32 Shell" if you want to build a 32-bit version, or "MinGW-w64 Win64 Shell" if you want to build a 64-bit version.

RawTherapee can be built using GTK+ versions 2 or 3. To build using GTK2 use the master branch; to build using GTK3 use the gtk3 branch. We will drop support for GTK2 after RawTherapee 5 is released, so the sooner you switch to GTK3 the better.

1 Install tools and libraries

First, install a few miscellaneous tools:

$ pacman -S tar gzip nano make diffutils intltool git

Then install the necessary development tools:

# win32
$ pacman -S mingw-w64-i686-gcc mingw-w64-i686-gdb mingw-w64-i686-make mingw-w64-i686-pkg-config mingw-w64-i686-cmake
# win64
$ pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-gdb mingw-w64-x86_64-make mingw-w64-x86_64-pkg-config mingw-w64-x86_64-cmake

and the required libraries:

# win32
$ pacman -S mingw-w64-i686-gtkmm mingw-w64-i686-gtkmm3 mingw-w64-i686-lcms2 mingw-w64-i686-fftw
# win64
$ pacman -S mingw-w64-x86_64-gtkmm mingw-w64-x86_64-gtkmm3 mingw-w64-x86_64-lcms2 mingw-w64-x86_64-fftw

2 Download and build libiptcdata

The libiptcdata library is not yet provided by MSYS2, therefore it should be downloaded and configured using:

$ curl -LO http://downloads.sourceforge.net/project/libiptcdata/libiptcdata/1.0.4/libiptcdata-1.0.4.tar.gz
$ tar xzf libiptcdata-1.0.4.tar.gz
$ cd libiptcdata-1.0.4

# win32
$ ./configure --prefix=/mingw32
# win64
$ ./configure --prefix=/mingw64

Afterwards the Makefile needs to be opened using a text editor to remove iptc and docs from the lists named SUBDIRS and DIST_SUBDIRS, as building or installing will fail otherwise:

$ nano Makefile

# Replace
DIST_SUBDIRS = m4 libiptcdata po iptc docs win python
# with
DIST_SUBDIRS = m4 libiptcdata po win python

# And replace
SUBDIRS = m4 libiptcdata po iptc docs win $(MAYBE_PYTHONLIB)
# with
SUBDIRS = m4 libiptcdata po win $(MAYBE_PYTHONLIB)

Finally build and install the library:

$ make
$ make install
$ cd

3 Download and build Clearlooks

If you are building RawTherapee using GTK2 - the master branch - then you need the Clearlooks theme engine. You do not need it if you are building using GTK3 - the gtk3 branch.

Download and build it:

$ curl -LO http://sources.archlinux.org/other/gtk-engines/gtk-engines-2.21.0.tar.gz
$ tar xzf gtk-engines-2.21.0.tar.gz
$ cd gtk-engines-2.21.0

# win32
$ ./configure --prefix=/mingw32 --disable-all --enable-clearlooks
# win64
$ ./configure --prefix=/mingw64 --disable-all --enable-clearlooks

$ make
$ make install
$ cd

4 Clone and build RawTherapee

Clone RawTherapee's Git repository. The build process will fail if there is a space character anywhere in your build folder path. For example if your Windows username is "Zank Frappa" then your home path will be C:\Users\Zank Frappa\ and if you clone RawTherapee inside there then the build will fail during compilation. Simply clone to a folder where neither it nor its parent folders have a space in their name, for example C:\code\repo-rt

$ git clone http://github.com/Beep6581/RawTherapee.git /c/code/repo-rt
$ cd /c/code/repo-rt

RawTherapee can be built using GTK+ versions 2 or 3. To build using GTK2 use the master branch; to build using GTK3 use the gtk3 branch. We will drop support for GTK2 after RawTherapee 5 is released, so the sooner you switch to GTK3 the better. When you clone the repository you will automatically find yourself in the master branch. To switch to the gtk3 branch do the following:

$ git checkout gtk3

Then, create a separate directory for the build:

$ mkdir build
$ cd build

Note that if you switch branches then you must delete and recreate the build folder so that compilation starts from scratch in an empty folder, otherwise compilation is likely to fail. However if you are just updating without changing branches then you do not have to start with an empty build folder - you can just go into the existing one, and compilation will be faster because not everything will need to be recompiled.

Run CMake and Make:

$ make install

Please refer to the Linux article for an explanation of the various options passed to CMake and Make, including which "BUILD_TYPE" to use.

If you are building for 32-bit Windows XP and are using the release or relwithdebinfo "BUILD_TYPE", you will need to add the -mstackrealign compiler flag before the last two dots .. of the CMake command above:

-DCMAKE_C_FLAGS="-mstackrealign" -DCMAKE_CXX_FLAGS="-mstackrealign"

5 Copy RawTherapee and required DLLs

RawTherapee can now be started from the MSYS2 command line:

# for debug builds
$ cd debug
# for release builds
$ cd release
# for relwithdebinfo builds
$ cd relwithdebinfo
$ ./rawtherapee.exe

The file manager can be used to copy the contents of c:\code\repo-rt\build\<debug|release|relwithdebinfo> together with the necessary DLLs from <MSYS2>\<mingw32|mingw64>\bin into a RawTherapee installation folder, where <MSYS2> is the MSYS2 installation folder.

A (possibly incomplete) list of required DLLs is:


The following files also need to be copied:

<prefix>\bin\gspawn-<win32|win64>-helper.exe -> .
<prefix>\bin\gspawn-<win32|win64>-helper-console.exe -> .

<prefix>\lib\gtk-2.0\include -> .
<prefix>\lib\gtk-2.0\modules -> .
<prefix>\lib\gtk-2.0\2.10.0\engines -> .

<prefix>\share\glib-2.0\schemas\gschemas.compiled -> .\share\glib-2.0\schemas

where <prefix> is <MSYS2>\<mingw32|mingw64> from above and . is the installation folder.

6 Creating a distributable package

If you plan to distribute RawTherapee packages for the Windows platform, as a first step you need to make sure that RawTherapee will be built for the "generic" processor target. To do so, use -DPROC_TARGET_NUMBER="1" in the CMake command.

During compilation, a script named WindowsInnoSetup.iss is created in the RawTherapee installation folder. This script is used by Inno Setup [1], a program which is used to generate installers for Windows programs. It is advised to download the Unicode version [2] to avoid problems with some languages. The current WindowsInnoSetup.iss script is designed for the current master branch (GTK2). If you want to create a package for the GTK3 branch you will need to edit the script and replace the line:

Source: "{#MyBuildBasePath}\lib\*"; DestDir: "{app}\lib\"; Flags: ignoreversion recursesubdirs createallsubdirs


Source: "{#MyBuildBasePath}\share\*"; DestDir: "{app}\share\"; Flags: ignoreversion recursesubdirs createallsubdirs

so that icons and schemas will be copied into the package.

To help users write useful bug reports, package maintainers are encouraged to produce "debug" builds along with each of their "release" builds, and to bundle them together with the GDB debugger executable. An alternative is to produce "relwithdebinfo" builds - these are just about as fast as "release" builds, but provide just about as much useful information as "debug" builds. When making "relwithdebinfo" or "debug" builds you must provide the GDB debugger executable. Windows binaries of the debugger gdb.exe can be downloaded from here in 32- and 64-bit versions.

The gdb.exe binary should be copied to the RawTherapee installation folder and, if using Inno Setup to generate the package, the WindowsInnoSetup.iss script should be edited by adding the following line around line 121 of the script:

Source: "{#MyBuildBasePath}\gdb.exe"; DestDir: "{app}"; Flags: ignoreversion

Note that GDB is a program released under the GNU GPL license, its source code can be downloaded at [3].

Now that everything is set up, to create the package right-click on the WindowsInnoSetup.iss script and choose Compile from the context menu. It will automatically generate the installer and place it in the parent folder. To make your new package compatible with the RawTherapee website's upload panel, create a zip archive in which you'll place both the newly created installer and the corresponding AboutThisBuild.txt file which can be found at the same place. Name the resulting zip archive following this template: RawTherapee_<WinXP|WinVista>_<32|64>_branch_buildtype_version.zip

"WinXP" means that the build is only for Windows XP. "WinVista" means it can run on any version of Windows from Vista upwards, including 10.

For example: RawTherapee_WinVista_64_gtk3_release_4.2.730.zip