1# Windows Development Guide for rdiff-backup 2 3Some notes for developers and other people willing to help development on 4Windows platform, or simply compile rdiff-backup from source code on Windows. 5 6See also: https://wiki.python.org/moin/WindowsCompilers 7 8## Pre-requisites 9 10Here the list of required component to be install to start developing 11rdiff-backup on Windows platform. 12 13### Upgrade your Windows OS 14Don't overlook this step. Visual Studio required an upgraded OS. 15Use Windows Update to upgrade your system. Then proceed with the installation. 16 17### Visual Studio Build Tools 18 191. To install Visual Studio Build Tools, you need to install .NET Framework 4.6. 20 [Download .NET Framework 4.6](https://www.microsoft.com/en-US/download/details.aspx?id=53344) 212. Finally, download Build Tools installation. 22 [Microsoft Build Tools for Visual Studio 2019](https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2019) 233. Once downloaded, the filename should be `vs_buildtools.exe` or similar, launch it to start the installation. 244. From the user interface select "C++ Build Tools" 255. In the right panel checked the following items. Everything else may be unchecked. 26 * MSVCv142 - VS 2019 C++ x64/x86 build tools 27 * Windows 10 SDK 28 * C++ CMake Tools for Windows 29 30### Python 3 31 32[Download Python 3.7.5 x86](https://www.python.org/ftp/python/3.7.5/python-3.7.5.exe) 33 341. Check "Add Python 3.7 to PATH" 352. Choose "Customize instalation" to select the installation path. 363. Check "Install for all users". That should install Python to `C:\Program Files (x86)\Python37-32` 37 38You could verify if Python is working by executing `python --version` in a new command line windows. 39 40NOTICE: Python 3.7.3 is not supported because it failed to compile external libraries. 41 42### Python dependencies 43 44Once python is installed, you should have a `pip` available from command line. 45Open a terminal and execut the following commands to install the dependencies required to compile and run rdiff-backup. 46 47 pip install pywin32 pyinstaller wheel 48 49You could verify if packages are properly installed using: 50 51 python -c "import pywintypes, winnt, win32api, win32security, win32file, win32con" 52 53### CMake 54 55[Download CMake 3.16.2 x64](https://github.com/Kitware/CMake/releases/download/v3.16.2/cmake-3.16.2-win64-x64.msi) 56 571. Make sure to select *Add CMake to the system PATH for all users*. 582. Install CMake to : `C:\Program Files\CMake\` 59 60You could verify if cmake is working. Open a new terminal and execute `cmake --version`. 61 62### 7z 63 64[Download 7z 19.00 x64](https://www.7-zip.org/a/7z1900-x64.exe) 65 66Install with default settings. 67 68## Build librsync 69 70[Download librsync 2.2.1 sources](https://github.com/librsync/librsync/releases/download/v2.2.1/librsync-2.2.1.tar.gz) 71 721. Extract it content using 7z `C:\librsync-2.2.1\`. 732. Open a "Developer Command Prompt for VS2019" from the start menu. 743. Type `cd C:\librsync-2.2.1\` 754. `cmake -DCMAKE_INSTALL_PREFIX=C:\librsync\ -A Win32 -DBUILD_SHARED_LIBS=OFF .` 765. `cmake --build . --config Release` 776. `cmake --install . --config Release` 78 79Notice: Source directory `C:\librsync-2.2.1\` should be in a seperate directory then target directory `C:\librsync\`. 80 81## Build rdiff-backup 82 83[Download rdiff-backup tar.gz](https://github.com/rdiff-backup/rdiff-backup/releases) e.g.: rdiff-backup-1.4.0b0.tar.gz 84 851. Extract it content using 7z `C:\rdiff-backup\` 862. Open a Command line terminal 873. Type `cd C:\rdiff-backup\` 884. `set LIBRSYNC_DIR=C:\librsync` 894. `python setup.py build` 90 91## Troubleshooting 92 93### Verify if Visual studio compiler is working 94 95You could check if the compiler `cl` is working by calling: 96 97 cl.exe hello.c 98 99Where the file `hello.c` contains: 100 101 #include <stdio.h> 102 int main() { 103 // printf() displays the string inside quotation 104 printf("Hello, World!"); 105 return 0; 106 } 107 108The expected output should be as follow: 109 110 Compilateur d'optimisation Microsoft (R) C/C++ version 19.24.28314 pour x86 111 Copyright (C) Microsoft Corporation. Tous droits réservés. 112 113 hello.c 114 Microsoft (R) Incremental Linker Version 14.24.28314.0 115 Copyright (C) Microsoft Corporation. All rights reserved. 116 117 /out:hello.exe 118 hello.obj 119