4 Below are some notes on how to build Bitcoin Core for Windows.
6 Most developers use cross-compilation from Ubuntu to build executables for
7 Windows. Cross-compilation is also used to build the release binaries.
9 Currently only building on Ubuntu Trusty 14.04 or Ubuntu Zesty 17.04 or later is supported.
10 Building on Ubuntu Xenial 16.04 is known to be broken, see extensive discussion in issue [8732](https://github.com/bitcoin/bitcoin/issues/8732).
11 While it may be possible to do so with work arounds, it's potentially dangerous and not recommended.
13 While there are potentially a number of ways to build on Windows (for example using msys / mingw-w64),
14 using the Windows Subsystem For Linux is the most straightforward. If you are building with
15 another method, please contribute the instructions here for others who are running versions
16 of Windows that are not compatible with the Windows Subsystem for Linux.
18 Compiling with Windows Subsystem For Linux
19 -------------------------------------------
21 With Windows 10, Microsoft has released a new feature named the [Windows
22 Subsystem for Linux](https://msdn.microsoft.com/commandline/wsl/about). This
23 feature allows you to run a bash shell directly on Windows in an Ubuntu-based
24 environment. Within this environment you can cross compile for Windows without
25 the need for a separate Linux VM or server.
27 This feature is not supported in versions of Windows prior to Windows 10 or on
28 Windows Server SKUs. In addition, it is available [only for 64-bit versions of
29 Windows](https://msdn.microsoft.com/en-us/commandline/wsl/install_guide).
31 To get the bash shell, you must first activate the feature in Windows.
33 1. Turn on Developer Mode
34 * Open Settings -> Update and Security -> For developers
35 * Select the Developer Mode radio button
36 * Restart if necessary
37 2. Enable the Windows Subsystem for Linux feature
38 * From Start, search for "Turn Windows features on or off" (type 'turn')
39 * Select Windows Subsystem for Linux (beta)
41 * Restart if necessary
42 3. Complete Installation
43 * Open a cmd prompt and type "bash"
45 * Create a new UNIX user account (this is a separate account from your Windows account)
47 After the bash shell is active, you can follow the instructions below, starting
48 with the "Cross-compilation" section. Compiling the 64-bit version is
49 recommended but it is possible to compile the 32-bit version.
54 These steps can be performed on, for example, an Ubuntu VM. The depends system
55 will also work on other Linux distributions, however the commands for
56 installing the toolchain will be different.
58 First, install the general dependencies:
60 sudo apt-get install build-essential libtool autotools-dev automake pkg-config bsdmainutils curl
62 A host toolchain (`build-essential`) is necessary because some dependency
63 packages (such as `protobuf`) need to build host utilities that are used in the
66 See also: [dependencies.md](dependencies.md).
68 If you're building on Ubuntu 17.04 or later, run these two commands, selecting the 'posix' variant for both,
69 to work around issues with mingw-w64. See issue [8732](https://github.com/bitcoin/bitcoin/issues/8732) for more information.
71 sudo update-alternatives --config x86_64-w64-mingw32-g++
72 sudo update-alternatives --config x86_64-w64-mingw32-gcc
75 ## Building for 64-bit Windows
77 To build executables for Windows 64-bit, install the following dependencies:
79 sudo apt-get install g++-mingw-w64-x86-64 mingw-w64-x86-64-dev
83 PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g') # strip out problematic Windows %PATH% imported var
85 make HOST=x86_64-w64-mingw32
87 ./autogen.sh # not required when building from tarball
88 CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/
91 ## Building for 32-bit Windows
93 To build executables for Windows 32-bit, install the following dependencies:
95 sudo apt-get install g++-mingw-w64-i686 mingw-w64-i686-dev
99 PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g') # strip out problematic Windows %PATH% imported var
101 make HOST=i686-w64-mingw32
103 ./autogen.sh # not required when building from tarball
104 CONFIG_SITE=$PWD/depends/i686-w64-mingw32/share/config.site ./configure --prefix=/
109 For further documentation on the depends system see [README.md](../depends/README.md) in the depends directory.
114 After building using the Windows subsystem it can be useful to copy the compiled
115 executables to a directory on the windows drive in the same directory structure
116 as they appear in the release `.zip` archive. This can be done in the following
117 way. This will install to `c:\workspace\bitcoin`, for example:
119 make install DESTDIR=/mnt/c/workspace/bitcoin