Difference between revisions of "Windows"

m (Remove notice about libiptcdata here)
 
(27 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Note: this page is being updated by Gaaned92. Please review it in his User page before it is copied back here
+
<div class="pagetitle">Windows</div>
  
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 [https://msys2.github.io/ 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.
+
Follow the instructions on this page to compile RawTherapee on Windows using the [https://www.msys2.org MSYS2] build environment. For more details on customizing and understanding the build process, see the [[Linux]] article.
  
RawTherapee can be built using GTK+ versions 2 or 3. To build using GTK2 use the <code>gtk2</code> branch; to build using GTK3 use the <code>dev</code> branch. The last version of RawTherapee to support GTK2 is 5.0-r1-gtk2 released on 2017-02-02. Use the <code>dev</code> branch for the latest code - it requires GTK+ >=3.16. We recommend using GTK+ 3.22.24 or newer as this is the first version to support native windows, without which the RawTherapee window could exhibit [https://github.com/Beep6581/RawTherapee/issues/4125 strange behavior] such as maximizing under the taskbar in Windows 10.
+
Note: this guide applies to compiling the '''64-bit''' version of RawTherapee under '''Windows 7 and newer'''. Compiling the 32-bit version is no longer supported, nor is compilation on older operating systems. The latest version of RawTherapee to work under 32-bit Windows XP is 5.0-rc1, and can be downloaded [http://www.rawtherapee.com/downloads/5.0-r1/ here] (dated 2017-02-02).
  
== Install tools and libraries ==
+
Note that RawTherapee also requires the availability of GTK+ 3.22.24 or newer to have [https://gitlab.gnome.org/GNOME/gtk/issues/760#note_110809 native window support]. Without it RawTherapee may exhibit [https://github.com/Beep6581/RawTherapee/issues/4125 strange behavior], such as maximizing underneath the taskbar in Windows 10. When using an up to date build environment, you should not encounter this problem.
  
 +
== MSYS2 Installation ==
 +
 +
=== Install MSYS2 base system ===
 +
 +
Install the build environment MSYS2 carefully by following the instructions from the [https://www.msys2.org MSYS2 website]. Make sure to update the system fully until no further updates are available, using the command:
 +
<pre style="white-space: pre-wrap">
 +
$ pacman -Syu
 +
</pre>
 +
 +
MSYS2 provides [https://www.msys2.org/wiki/MSYS2-introduction/ three 'shells'] (command-line interfaces) for different purposes: '''MSYS''', '''MinGW 32-bit''' and '''MinGW 64-bit'''. They can be launched through shortcuts in your Start menu. Most commonly you will be running a 64-bit operating system and will want to create applications that are optimized for that. Therefore, start the '''MSYS2 MinGW 64-bit''' shell and continue below.
 +
 +
[[File:MSYS2 Shell.jpg]]
 +
 +
Note: in following text, <code><MSYS2></code> refers to the MSYS2 installation folder, typically <code>C:\msys64</code>
 +
 +
=== Install tools and libraries ===
 +
 +
MSYS2 uses the package manager <code>pacman</code> to install software and components. Please refer to the [https://wiki.archlinux.org/index.php/pacman pacman manual] for details.
 +
 
First, install a few miscellaneous tools:
 
First, install a few miscellaneous tools:
 
<pre style="white-space: pre-wrap">
 
<pre style="white-space: pre-wrap">
Line 12: Line 31:
 
</pre>
 
</pre>
  
Then install the necessary development tools:
+
Then install the necessary development tools and the required libraries:
 
<pre style="white-space: pre-wrap">
 
<pre style="white-space: pre-wrap">
# win32
+
$ 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 mingw-w64-x86_64-ninja mingw-w64-x86_64-gtkmm3 mingw-w64-x86_64-lcms2 mingw-w64-x86_64-fftw mingw-w64-x86_64-lensfun mingw-w64-x86_64-libiptcdata
$ 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
 
 
</pre>
 
</pre>
and the required libraries:
+
 
 +
=== Updating Lensfun database ===
 +
 
 +
RawTherapee uses the [https://lensfun.github.io Lensfun] library for lens-specific corrections. Run the following command to update the database:
 
<pre style="white-space: pre-wrap">
 
<pre style="white-space: pre-wrap">
# win32
+
$ lensfun-update-data
$ 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 mingw-w64-x86_64-lensfun
 
 
</pre>
 
</pre>
 +
The updater returns the path where the updated database is located. '''Copy this path for later use!'''
  
== Download and build libiptcdata ==
+
=== Download and build libiptcdata ===
  
The libiptcdata library is not yet provided by MSYS2, therefore it should be downloaded and configured using:
+
Since December 2020 the <code>libiptcdata</code> library is provided by MSYS2 and no longer requires manual compilation. <i>Only if you experience problems using this library</i>, follow the instructions below to manually build it. Otherwise, continue to the next section.
 
<pre style="white-space: pre-wrap">
 
<pre style="white-space: pre-wrap">
 +
$ cd ~
 
$ curl -LO http://downloads.sourceforge.net/project/libiptcdata/libiptcdata/1.0.4/libiptcdata-1.0.4.tar.gz
 
$ 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
 
$ tar xzf libiptcdata-1.0.4.tar.gz
 
$ cd libiptcdata-1.0.4
 
$ cd libiptcdata-1.0.4
 
# win32
 
$ ./configure --prefix=/mingw32
 
# win64
 
 
$ ./configure --prefix=/mingw64
 
$ ./configure --prefix=/mingw64
 
</pre>
 
</pre>
  
Afterwards the <code>Makefile</code> needs to be opened using a text editor to remove <code>iptc</code> and <code>docs</code> from the lists named <code>SUBDIRS</code> and <code>DIST_SUBDIRS</code>, as building or installing will fail otherwise:
+
Some modifications to the resulting <code>Makefile</code> are needed. You can edit the file with any text editor (either through your OS or from within the shell). We use the <code>nano</code> editor from within the shell:
 
<pre style="white-space: pre-wrap">
 
<pre style="white-space: pre-wrap">
 
$ nano Makefile
 
$ nano Makefile
  
# Replace
+
# search (command Ctrl+W)
 
DIST_SUBDIRS = m4 libiptcdata po iptc docs win python
 
DIST_SUBDIRS = m4 libiptcdata po iptc docs win python
# with
+
# and replace with
 
DIST_SUBDIRS = m4 libiptcdata po win python
 
DIST_SUBDIRS = m4 libiptcdata po win python
  
# And replace
+
# search
 
SUBDIRS = m4 libiptcdata po iptc docs win $(MAYBE_PYTHONLIB)
 
SUBDIRS = m4 libiptcdata po iptc docs win $(MAYBE_PYTHONLIB)
# with
+
# and replace with
 
SUBDIRS = m4 libiptcdata po win $(MAYBE_PYTHONLIB)
 
SUBDIRS = m4 libiptcdata po win $(MAYBE_PYTHONLIB)
 +
 +
# save and quit
 +
Ctrl+X, Y
 
</pre>
 
</pre>
  
 
Finally build and install the library:
 
Finally build and install the library:
 
<pre style="white-space: pre-wrap">
 
<pre style="white-space: pre-wrap">
$ make
 
 
$ make install
 
$ make install
$ cd
 
</pre>
 
 
== Download and build Clearlooks ==
 
 
If you are building RawTherapee using GTK2 then you need the Clearlooks theme engine. You do not need it if you are building using GTK3.
 
 
Download and build it:
 
<pre style="white-space: pre-wrap">
 
$ 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
 
 
</pre>
 
</pre>
  
 
== Clone and build RawTherapee ==
 
== Clone and build RawTherapee ==
  
Clone RawTherapee's Git repository. The build process will fail if there is a space character anywhere in your <code>build</code> folder path. For example if your Windows username is "Zank Frappa" then your home path will be <code>C:\Users\Zank Frappa\</code> 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 <code>C:\code\repo-rt</code>
+
=== Clone RawTherapee's git repository. ===
 +
RawTherapee's source code can be cloned from [https://github.com/Beep6581/RawTherapee the official GitHub repository]:
 
<pre style="white-space: pre-wrap">
 
<pre style="white-space: pre-wrap">
$ git clone http://github.com/Beep6581/RawTherapee.git /c/code/repo-rt
+
$ cd ~
$ cd /c/code/repo-rt
+
$ git clone git://github.com/Beep6581/RawTherapee.git
 +
$ cd RawTherapee
 
</pre>
 
</pre>
  
RawTherapee can be built using GTK+ versions 2 or 3. To build using GTK2 use the <code>gtk2</code> branch; to build using GTK3 use the <code>dev</code> branch. The last version of RawTherapee to support GTK2 is 5.0-r1-gtk2 released on 2017-02-02. Use the <code>dev</code> branch for the latest code - it requires GTK+ >=3.16. When you clone the repository you will automatically find yourself in the <code>dev</code> branch. To switch to the <code>dev</code> branch manually, do the following:
+
=== Switching branches ===
 +
After cloning you will automatically have checked out the <code>dev</code> branch. This is the main development branch of RawTherapee and probably what you want to use. To switch to a [https://github.com/Beep6581/RawTherapee/branches different branch], do the following:
 
<pre style="white-space: pre-wrap">
 
<pre style="white-space: pre-wrap">
$ git checkout dev
+
$ git checkout branchname # replace with another available branch name
 
</pre>
 
</pre>
  
Create a separate directory for the build:
+
=== Create a separate directory for the build ===
 +
It is essential to create a new directory to build the application. The directory can have any name, for example:
 
<pre style="white-space: pre-wrap">
 
<pre style="white-space: pre-wrap">
 
$ mkdir build
 
$ mkdir build
Line 102: Line 101:
 
</pre>
 
</pre>
  
Note that if you switch branches then you must delete and recreate the <code>build</code> 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.
+
Note: if you switch branches, ''always build in an empty directory'' to prevent issues. From within a build directory, you can run <code>rm -rf *</code> to remove all files.
  
Run CMake and Make:
+
=== Configuration and compilation ===
 +
To create an optimized build for your machine architecture, use the following commands:
 
<pre style="white-space: pre-wrap">
 
<pre style="white-space: pre-wrap">
$ cmake -G "MSYS Makefiles" -DLENSFUNDBDIR=share/lensfun -DCMAKE_BUILD_TYPE="release" -DPROC_TARGET_NUMBER="2" -DCACHE_NAME_SUFFIX="5-dev" ..
+
$ cmake -G "Ninja" -DLENSFUNDBDIR=put/your/lensfun/directory/here -DCMAKE_BUILD_TYPE="release" -DPROC_TARGET_NUMBER="2" -DCACHE_NAME_SUFFIX="5-dev" ..
$ make install
+
$ cmake --build . --target install
 
</pre>
 
</pre>
 +
Make sure to replace the path to the Lensfun database with the actual path obtained a few steps before. See the [[Linux#CMake|Linux article]] for more details on the various options. Depending on your system, the build process may take anywhere between 5 and 25 minutes.
  
You can find an explanation of the various CMake options in the [[Linux#CMake|Linux article]], including an explanation of the various "BUILD_TYPE" options.
+
There may be warnings during the build process which you can safely ignore. Errors that are not traceable to a mistake when following this guide should be reported [https://github.com/Beep6581/RawTherapee/issues/new?assignees=&labels=&template=bug_report.md&title= here].  
  
If you are building for 32-bit Windows XP and are using the <code>release</code> or <code>relwithdebinfo</code> "BUILD_TYPE", you will need to add the <code>-mstackrealign</code> compiler flag before the last two dots <code>..</code> of the CMake command above:
+
=== Starting RawTherapee ===
 +
RawTherapee can now be run:
 
<pre style="white-space: pre-wrap">
 
<pre style="white-space: pre-wrap">
-DCMAKE_C_FLAGS="-mstackrealign" -DCMAKE_CXX_FLAGS="-mstackrealign"
+
$ ./release/rawtherapee.exe # replace release with debug or relwithdebinfo if you built another target
 
</pre>
 
</pre>
  
== Copy RawTherapee and required DLLs ==
+
=== Optional: preloaded CMake cache ===
 +
As described in the [https://cmake.org/cmake/help/latest/manual/cmake.1.html CMake manual]
 +
<pre style="white-space: pre-wrap">
 +
-C <initial-cache>
 +
 
 +
    Pre-load a script to populate the cache.
 +
 
 +
    When cmake is first run in an empty build tree, it creates a CMakeCache.txt file and populates it with customizable settings for the project. This option may be used to specify a file from which to load cache entries before the first pass through the project’s cmake listfiles. The loaded entries take priority over the project’s default values. The given file should be a CMake script containing SET commands that use the CACHE option, not a cache-format file.
 +
</pre>
  
RawTherapee can now be started from the MSYS2 command line:
+
To simplify the invocation of CMake and be able to easily define Windows specific options, a <code>win.cmake</code> template script is provided with the sources. Copy it out of RawTherapee's source to avoid overwriting by update for instance in <code>mywin.cmake</code>.
 +
Edit it to define or modify options. To preload the cache, in the CMake command line:
 
<pre style="white-space: pre-wrap">
 
<pre style="white-space: pre-wrap">
# for debug builds
+
$ cmake -G "Ninja" -DLENSFUNDBDIR=share/lensfun -DCMAKE_BUILD_TYPE="release" -DPROC_TARGET_NUMBER="2" -DCACHE_NAME_SUFFIX="5-dev" -C <path/to/mywin.cmake> ..
$ cd debug
 
# for release builds
 
$ cd release
 
# for relwithdebinfo builds
 
$ cd relwithdebinfo
 
$ ./rawtherapee.exe
 
 
</pre>
 
</pre>
  
The file manager can be used to copy the contents of <code>c:\code\repo-rt\build\<debug|release|relwithdebinfo></code> together with the necessary DLLs from <code><prefix>\bin</code> into <code>.</code>, where:
+
== Making a bundled build ==
*<code><prefix></code> is <code><MSYS2>\<mingw32|mingw64></code>,
+
 
 +
This section only applies if you want to run RawTherapee outside the MinGW shell or distribute it.
 +
 
 +
Note: You can copy either with the Windows file manager or, recommended, with [https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy robocopy] inside the <code>mingw64</code> shell script using <code>-</code> instead of <code>/</code> for the options.
 +
 
 +
=== Definition of folders ===
 +
*<code><prefix></code> is <code><MSYS2>\mingw64</code>,
 
*<code><MSYS2></code> is the MSYS2 installation folder,
 
*<code><MSYS2></code> is the MSYS2 installation folder,
 
*and <code>.</code> is the RawTherapee installation folder.
 
*and <code>.</code> is the RawTherapee installation folder.
  
The current list of required DLLs is:
+
=== Copy RawTherapee executable and generated files ===
 +
Copy the content of <code>c:\code\repo-rt\build\<debug|release|relwithdebinfo></code> into <code>.</code>.
 +
 
 +
=== Copy the  dependencies ===
 +
Copy the necessary DLLs and exe from <code><prefix>\bin</code> into <code>.</code>.
 +
The current list of required DLLs and EXE is:
 
<pre style="white-space: pre-wrap">
 
<pre style="white-space: pre-wrap">
 +
gspawn-win64-helper.exe
 +
gspawn-win64-helper-console.exe
 +
gdbus.exe
 
libatk-1.0-0.dll
 
libatk-1.0-0.dll
 
libatkmm-1.6-1.dll
 
libatkmm-1.6-1.dll
Line 144: Line 163:
 
libcairomm-1.0-1.dll
 
libcairomm-1.0-1.dll
 
libcroco-0.6-3.dll
 
libcroco-0.6-3.dll
 +
libdatrie-1.dll
 
libepoxy-0.dll
 
libepoxy-0.dll
 
libexpat-1.dll
 
libexpat-1.dll
libffi-6.dll
+
libffi-6.dll
 
libfftw3f-3.dll
 
libfftw3f-3.dll
libfontconfig-1.dll
+
libfontconfig-1.dll
 
libfreetype-6.dll
 
libfreetype-6.dll
 +
libfribidi-0.dll
 
libgcc_s_seh-1.dll
 
libgcc_s_seh-1.dll
 
libgdk_pixbuf-2.0-0.dll
 
libgdk_pixbuf-2.0-0.dll
Line 183: Line 204:
 
libstdc++-6.dll
 
libstdc++-6.dll
 
libsystre-0.dll
 
libsystre-0.dll
 +
libthai-0.dll
 
libtiff-5.dll
 
libtiff-5.dll
 
libtre-5.dll
 
libtre-5.dll
 
libwinpthread-1.dll
 
libwinpthread-1.dll
 
libxml2-2.dll
 
libxml2-2.dll
 +
libzstd.dll
 
zlib1.dll
 
zlib1.dll
 
</pre>
 
</pre>
  
The following list of Adwaita theme files should be copied from <code><prefix>\share\icons\Adwaita\</code> to <code>.\share\icons\Adwaita\</code>:
+
Copy the following list of Adwaita theme files and directories  from <code><prefix>\share\icons\Adwaita\</code> to <code>.\share\icons\Adwaita\</code>:
 
<pre style="white-space: pre-wrap">
 
<pre style="white-space: pre-wrap">
16x16\actions\*
+
scalable\actions
16x16\devices\*
+
scalable\devices
16x16\mimetypes\*
+
scalable\mimetypes
16x16\places\*
+
scalable\places
16x16\status\*
+
scalable\status
48x48\devices\*
+
scalable\ui
24x24\status\image-missing.png
 
 
 
icon-theme.cache
 
 
index.theme
 
index.theme
 
 
cursors\plus.cur
 
cursors\plus.cur
 
cursors\sb_h_double_arrow.cur
 
cursors\sb_h_double_arrow.cur
Line 210: Line 229:
 
</pre>
 
</pre>
  
The following files also need to be copied:
+
Copy following files :
 
<pre style="white-space: pre-wrap">
 
<pre style="white-space: pre-wrap">
<prefix>\bin\gspawn-<win32|win64>-helper.exe -> .
 
<prefix>\bin\gspawn-<win32|win64>-helper-console.exe -> .
 
 
 
<prefix>\lib\gdk-pixbuf-2.0 -> .\lib\gdk-pixbuf-2.0
 
<prefix>\lib\gdk-pixbuf-2.0 -> .\lib\gdk-pixbuf-2.0
 
 
<prefix>\share\glib-2.0\schemas\gschemas.compiled -> .\share\glib-2.0\schemas
 
<prefix>\share\glib-2.0\schemas\gschemas.compiled -> .\share\glib-2.0\schemas
 
<prefix>\share\lensfun\version_1\* -> .\share\lensfun
 
<prefix>\share\lensfun\version_1\* -> .\share\lensfun
 
</pre>
 
</pre>
 +
 +
Create in .\share\gtk-3.0 a file <code>settings.ini</code> containing :
 +
<pre style="white-space: pre-wrap">
 +
[Settings] gtk-button-images=1
 +
</pre>
 +
 +
  
 
== Creating a distributable package ==
 
== Creating a distributable package ==
Line 227: Line 249:
 
During compilation, a script named <code>WindowsInnoSetup.iss</code> is created in the RawTherapee installation folder. This script is used by Inno Setup [http://www.jrsoftware.org/isinfo.php], a program which is used to generate installers for Windows programs. It is advised to download the Unicode version [http://www.jrsoftware.org/download.php/is-unicode.exe] to avoid problems with some languages.
 
During compilation, a script named <code>WindowsInnoSetup.iss</code> is created in the RawTherapee installation folder. This script is used by Inno Setup [http://www.jrsoftware.org/isinfo.php], a program which is used to generate installers for Windows programs. It is advised to download the Unicode version [http://www.jrsoftware.org/download.php/is-unicode.exe] to avoid problems with some languages.
  
The current <code>WindowsInnoSetup.iss</code> script is designed for the <code>gtk2</code> branch. If you want to create a package for a GTK3 build (<code>dev</code> or <code>releases</code> branches) you will need to edit the script and replace the line:
+
To help users [[How_to_write_useful_bug_reports|write useful bug reports]], package maintainers are encouraged to produce builds which include both a "release" and a "debug" executable, and to bundle them together with the GDB debugger executable.
 
 
<pre style="white-space: pre-wrap">
 
Source: "{#MyBuildBasePath}\lib\*"; DestDir: "{app}\lib\"; Flags: ignoreversion recursesubdirs createallsubdirs
 
</pre>
 
 
 
with
 
 
 
<pre style="white-space: pre-wrap">
 
Source: "{#MyBuildBasePath}\share\*"; DestDir: "{app}\share\"; Flags: ignoreversion recursesubdirs createallsubdirs
 
</pre>
 
 
 
so that icons and schemas will be copied into the package.
 
 
 
To help users [[How_to_write_useful_bug_reports|write useful bug reports]], package maintainers are encouraged to produce builds which include both a "release" and a "debug" executable, and to bundle them together with the GDB debugger executable. In other words, put the <code>rawtherapee.exe</code> (release) file together with the <code>rawtherapee-debug.exe</code> (debug) file and the <code>gdb.exe</code> file together into the same installer or the same archive. An alternative is to produce "relwithdebinfo" builds - these are much faster than "debug" but not as optimized as "release" builds, yet they 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 <code>gdb.exe</code> can be downloaded from [http://www.equation.com/servlet/equation.cmd?fa=gdb here] in 32- and 64-bit versions.
 
  
The <code>gdb.exe</code> binary, available from http://www.gnu.org/software/gdb/, should be copied into the RawTherapee installation folder and, if using Inno Setup to generate the package, the <code>WindowsInnoSetup.iss</code> script should be edited by uncommenting (removing the semicolon from the front of) the following around line 114 of the script:
+
In other words, put the <code>rawtherapee.exe</code> (release) file together with the <code>rawtherapee-debug.exe</code> (debug) file and the <code>gdb.exe</code> file together into the same installer or the same archive. An alternative is to produce "relwithdebinfo" builds - these are much faster than "debug" but not as optimized as "release" builds, yet they provide just about as much useful information as "debug" builds.
  
<pre style="white-space: pre-wrap">
+
When making "relwithdebinfo" or "debug" builds you must provide the GDB debugger executable. Windows binaries of the debugger <code>gdb.exe</code> can be downloaded from [http://www.equation.com/servlet/equation.cmd?fa=gdb here] in 32- and 64-bit versions and will be copied into Rawtherapee installation folder.
;Source: "{#MyBuildBasePath}\gdb.exe"; DestDir: "{app}"; Flags: ignoreversion
 
</pre>
 
  
 
Now that everything is set up, to create the package right-click on the <code>WindowsInnoSetup.iss</code> script and choose ''Compile'' from the context menu. It will automatically generate the installer and place it in the parent folder.
 
Now that everything is set up, to create the package right-click on the <code>WindowsInnoSetup.iss</code> 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 will 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:
 
To make your new package compatible with the RawTherapee website's upload panel, create a zip archive in which you will 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:
<code>RawTherapee_<WinXP|WinVista>_<32|64>_<version>_<buildtype>.zip</code>
+
<code>RawTherapee_<version>_WinVista_64_<buildtype>.zip</code>
  
* "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.
+
If you are building and distributing nightly builds, follow this template:
* The "version" will either look like <code>5.2</code> if you checkout the <code>5.2</code> tag, or <code>5.2-dev-g1a2b3c4d</code> if you checkout the <code>dev</code> branch after 5.2 was tagged.
+
<code>RawTherapee_<branch>_<version>_WinVista_64_<buildtype>.zip</code>
* If you are shipping more than one build type in an installer, include the names of all build types, e.g. <code>release_debug</code>.
 
  
For example:
+
* "WinVista"  means it can run on any version of Windows from Vista upwards, including 10.
* <code>RawTherapee_WinVista_64_5.2_release.zip</code>
+
* The "version" will either look like <code>5.8</code> if you checkout the <code>5.8</code> tag, or <code>5.8-g35abd92
* <code>RawTherapee_WinVista_64_5.2_release_debug.zip</code>
+
</code> if you checkout the <code>dev</code> branch after 5.8 was tagged.
* <code>RawTherapee_WinVista_64_5.2-dev-g1a2b3c4d_release_debug.zip</code>
+
* If you are shipping more than one build type in an installer, don't include <buildtype> in the name.

Latest revision as of 06:26, 17 June 2021

Windows

Follow the instructions on this page to compile RawTherapee on Windows using the MSYS2 build environment. For more details on customizing and understanding the build process, see the Linux article.

Note: this guide applies to compiling the 64-bit version of RawTherapee under Windows 7 and newer. Compiling the 32-bit version is no longer supported, nor is compilation on older operating systems. The latest version of RawTherapee to work under 32-bit Windows XP is 5.0-rc1, and can be downloaded here (dated 2017-02-02).

Note that RawTherapee also requires the availability of GTK+ 3.22.24 or newer to have native window support. Without it RawTherapee may exhibit strange behavior, such as maximizing underneath the taskbar in Windows 10. When using an up to date build environment, you should not encounter this problem.

1 MSYS2 Installation

1.1 Install MSYS2 base system

Install the build environment MSYS2 carefully by following the instructions from the MSYS2 website. Make sure to update the system fully until no further updates are available, using the command:

$ pacman -Syu

MSYS2 provides three 'shells' (command-line interfaces) for different purposes: MSYS, MinGW 32-bit and MinGW 64-bit. They can be launched through shortcuts in your Start menu. Most commonly you will be running a 64-bit operating system and will want to create applications that are optimized for that. Therefore, start the MSYS2 MinGW 64-bit shell and continue below.

MSYS2 Shell.jpg

Note: in following text, <MSYS2> refers to the MSYS2 installation folder, typically C:\msys64

1.2 Install tools and libraries

MSYS2 uses the package manager pacman to install software and components. Please refer to the pacman manual for details.

First, install a few miscellaneous tools:

$ pacman -S tar gzip nano make diffutils intltool git

Then install the necessary development tools and the required libraries:

$ 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 mingw-w64-x86_64-ninja mingw-w64-x86_64-gtkmm3 mingw-w64-x86_64-lcms2 mingw-w64-x86_64-fftw mingw-w64-x86_64-lensfun mingw-w64-x86_64-libiptcdata

1.3 Updating Lensfun database

RawTherapee uses the Lensfun library for lens-specific corrections. Run the following command to update the database:

$ lensfun-update-data

The updater returns the path where the updated database is located. Copy this path for later use!

1.4 Download and build libiptcdata

Since December 2020 the libiptcdata library is provided by MSYS2 and no longer requires manual compilation. Only if you experience problems using this library, follow the instructions below to manually build it. Otherwise, continue to the next section.

$ cd ~
$ 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
$ ./configure --prefix=/mingw64

Some modifications to the resulting Makefile are needed. You can edit the file with any text editor (either through your OS or from within the shell). We use the nano editor from within the shell:

$ nano Makefile

# search (command Ctrl+W)
DIST_SUBDIRS = m4 libiptcdata po iptc docs win python
# and replace with
DIST_SUBDIRS = m4 libiptcdata po win python

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

# save and quit
Ctrl+X, Y

Finally build and install the library:

$ make install

2 Clone and build RawTherapee

2.1 Clone RawTherapee's git repository.

RawTherapee's source code can be cloned from the official GitHub repository:

$ cd ~
$ git clone git://github.com/Beep6581/RawTherapee.git
$ cd RawTherapee

2.2 Switching branches

After cloning you will automatically have checked out the dev branch. This is the main development branch of RawTherapee and probably what you want to use. To switch to a different branch, do the following:

$ git checkout branchname # replace with another available branch name

2.3 Create a separate directory for the build

It is essential to create a new directory to build the application. The directory can have any name, for example:

$ mkdir build
$ cd build

Note: if you switch branches, always build in an empty directory to prevent issues. From within a build directory, you can run rm -rf * to remove all files.

2.4 Configuration and compilation

To create an optimized build for your machine architecture, use the following commands:

$ cmake -G "Ninja" -DLENSFUNDBDIR=put/your/lensfun/directory/here -DCMAKE_BUILD_TYPE="release" -DPROC_TARGET_NUMBER="2" -DCACHE_NAME_SUFFIX="5-dev" ..
$ cmake --build . --target install

Make sure to replace the path to the Lensfun database with the actual path obtained a few steps before. See the Linux article for more details on the various options. Depending on your system, the build process may take anywhere between 5 and 25 minutes.

There may be warnings during the build process which you can safely ignore. Errors that are not traceable to a mistake when following this guide should be reported here.

2.5 Starting RawTherapee

RawTherapee can now be run:

$ ./release/rawtherapee.exe # replace release with debug or relwithdebinfo if you built another target

2.6 Optional: preloaded CMake cache

As described in the CMake manual

-C <initial-cache>

    Pre-load a script to populate the cache.

    When cmake is first run in an empty build tree, it creates a CMakeCache.txt file and populates it with customizable settings for the project. This option may be used to specify a file from which to load cache entries before the first pass through the project’s cmake listfiles. The loaded entries take priority over the project’s default values. The given file should be a CMake script containing SET commands that use the CACHE option, not a cache-format file.

To simplify the invocation of CMake and be able to easily define Windows specific options, a win.cmake template script is provided with the sources. Copy it out of RawTherapee's source to avoid overwriting by update for instance in mywin.cmake. Edit it to define or modify options. To preload the cache, in the CMake command line:

$ cmake -G "Ninja" -DLENSFUNDBDIR=share/lensfun -DCMAKE_BUILD_TYPE="release" -DPROC_TARGET_NUMBER="2" -DCACHE_NAME_SUFFIX="5-dev" -C <path/to/mywin.cmake> ..

3 Making a bundled build

This section only applies if you want to run RawTherapee outside the MinGW shell or distribute it.

Note: You can copy either with the Windows file manager or, recommended, with robocopy inside the mingw64 shell script using - instead of / for the options.

3.1 Definition of folders

  • <prefix> is <MSYS2>\mingw64,
  • <MSYS2> is the MSYS2 installation folder,
  • and . is the RawTherapee installation folder.

3.2 Copy RawTherapee executable and generated files

Copy the content of c:\code\repo-rt\build\<debug|release|relwithdebinfo> into ..

3.3 Copy the dependencies

Copy the necessary DLLs and exe from <prefix>\bin into .. The current list of required DLLs and EXE is:

gspawn-win64-helper.exe
gspawn-win64-helper-console.exe
gdbus.exe
libatk-1.0-0.dll
libatkmm-1.6-1.dll
libbz2-1.dll
libcairo-2.dll
libcairo-gobject-2.dll
libcairomm-1.0-1.dll
libcroco-0.6-3.dll
libdatrie-1.dll
libepoxy-0.dll
libexpat-1.dll
libffi-6.dll
libfftw3f-3.dll
libfontconfig-1.dll
libfreetype-6.dll
libfribidi-0.dll
libgcc_s_seh-1.dll
libgdk_pixbuf-2.0-0.dll
libgdk-3-0.dll
libgdkmm-3.0-1.dll
libgio-2.0-0.dll
libgiomm-2.4-1.dll
libglib-2.0-0.dll
libglibmm-2.4-1.dll
libgmodule-2.0-0.dll
libgobject-2.0-0.dll
libgomp-1.dll
libgraphite2.dll
libgtk-3-0.dll
libgtkmm-3.0-1.dll
libharfbuzz-0.dll
libiconv-2.dll
libintl-8.dll
libjpeg-8.dll
liblcms2-2.dll
liblensfun.dll
liblzma-5.dll
libpango-1.0-0.dll
libpangocairo-1.0-0.dll
libpangoft2-1.0-0.dll
libpangomm-1.4-1.dll
libpangowin32-1.0-0.dll
libpcre-1.dll
libpixman-1-0.dll
libpng16-16.dll
librsvg-2-2.dll
libsigc-2.0-0.dll
libstdc++-6.dll
libsystre-0.dll
libthai-0.dll
libtiff-5.dll
libtre-5.dll
libwinpthread-1.dll
libxml2-2.dll
libzstd.dll
zlib1.dll

Copy the following list of Adwaita theme files and directories from <prefix>\share\icons\Adwaita\ to .\share\icons\Adwaita\:

scalable\actions
scalable\devices
scalable\mimetypes
scalable\places
scalable\status
scalable\ui
index.theme
cursors\plus.cur
cursors\sb_h_double_arrow.cur
cursors\sb_left_arrow.cur
cursors\sb_right_arrow.cur
cursors\sb_v_double_arrow.cur

Copy following files :

<prefix>\lib\gdk-pixbuf-2.0 -> .\lib\gdk-pixbuf-2.0
<prefix>\share\glib-2.0\schemas\gschemas.compiled -> .\share\glib-2.0\schemas
<prefix>\share\lensfun\version_1\* -> .\share\lensfun

Create in .\share\gtk-3.0 a file settings.ini containing :

[Settings] gtk-button-images=1


4 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.

To help users write useful bug reports, package maintainers are encouraged to produce builds which include both a "release" and a "debug" executable, and to bundle them together with the GDB debugger executable.

In other words, put the rawtherapee.exe (release) file together with the rawtherapee-debug.exe (debug) file and the gdb.exe file together into the same installer or the same archive. An alternative is to produce "relwithdebinfo" builds - these are much faster than "debug" but not as optimized as "release" builds, yet they 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 and will be copied into Rawtherapee installation folder.

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 will 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_<version>_WinVista_64_<buildtype>.zip

If you are building and distributing nightly builds, follow this template: RawTherapee_<branch>_<version>_WinVista_64_<buildtype>.zip

  • "WinVista" means it can run on any version of Windows from Vista upwards, including 10.
  • The "version" will either look like 5.8 if you checkout the 5.8 tag, or 5.8-g35abd92

if you checkout the dev branch after 5.8 was tagged.

  • If you are shipping more than one build type in an installer, don't include <buildtype> in the name.