Skip to content

Commit c4522e7

Browse files
author
MarcoFalke
committed
Merge #9219: doc: Improve windows build instructions using Linux subsystem
dd34570 doc: Improve windows build instructions using Linux subsystem (Wladimir J. van der Laan)
2 parents 76fec09 + dd34570 commit c4522e7

File tree

1 file changed

+46
-20
lines changed

1 file changed

+46
-20
lines changed

doc/build-windows.md

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@ Most developers use cross-compilation from Ubuntu to build executables for
77
Windows. This is also used to build the release binaries.
88

99
While there are potentially a number of ways to build on Windows (for example using msys / mingw-w64),
10-
using the Windows Subsystem For Linux is the most straight forward. If you are building with
11-
an alternative method, please contribute the instructions here for others who are running versions
10+
using the Windows Subsystem For Linux is the most straightforward. If you are building with
11+
another method, please contribute the instructions here for others who are running versions
1212
of Windows that are not compatible with the Windows Subsystem for Linux.
1313

14-
Compiling with the Windows Subsystem For Linux
15-
-------------------
14+
Compiling with Windows Subsystem For Linux
15+
-------------------------------------------
1616

17-
With Windows 10, Microsoft has released a new feature named the
18-
[Windows Subsystem for Linux](https://msdn.microsoft.com/commandline/wsl/about). This feature allows you to run a bash shell directly on Windows in an Ubuntu based
19-
environment. Within this environment you can cross compile for Windows without the need for a separate Linux VM or Server.
17+
With Windows 10, Microsoft has released a new feature named the [Windows
18+
Subsystem for Linux](https://msdn.microsoft.com/commandline/wsl/about). This
19+
feature allows you to run a bash shell directly on Windows in an Ubuntu based
20+
environment. Within this environment you can cross compile for Windows without
21+
the need for a separate Linux VM or Server.
2022

2123
This feature is not supported in versions of Windows prior to Windows 10 or on Windows Server SKUs.
2224

@@ -37,9 +39,6 @@ To get the bash shell, you must first activate the feature in Windows.
3739
* Create a new UNIX user account (this is a separate account from your Windows account)
3840

3941
After the bash shell is active, you can follow the instructions below for Windows 64-bit Cross-compilation.
40-
When building dependencies within the 'depends' folder, you may encounter an error building
41-
the protobuf dependency. If this occurs, re-run the command with sudo. This is likely
42-
a bug with the Windows Subsystem for Linux feature and may be fixed with a future update.
4342

4443
Cross-compilation
4544
-------------------
@@ -48,28 +47,55 @@ These steps can be performed on, for example, an Ubuntu VM. The depends system
4847
will also work on other Linux distributions, however the commands for
4948
installing the toolchain will be different.
5049

51-
Make sure you install the build requirements mentioned in
52-
[build-unix.md](/doc/build-unix.md).
53-
Then, install the toolchains and curl:
50+
First, install the general dependencies:
51+
52+
sudo apt-get install build-essential libtool autotools-dev automake pkg-config bsdmainutils curl
53+
54+
A host toolchain (`build-essential`) is necessary because some dependency
55+
packages (such as `protobuf`) need to build host utilities that are used in the
56+
build process.
57+
58+
## Building for 64-bit Windows
59+
60+
To build executables for Windows 64-bit, install the following dependencies:
5461

55-
sudo apt-get install g++-mingw-w64-i686 mingw-w64-i686-dev g++-mingw-w64-x86-64 mingw-w64-x86-64-dev curl
62+
sudo apt-get install g++-mingw-w64-x86-64 mingw-w64-x86-64-dev
5663

57-
To build executables for Windows 32-bit:
64+
Then build using:
5865

5966
cd depends
60-
make HOST=i686-w64-mingw32 -j4
67+
make HOST=x86_64-w64-mingw32 -j4
6168
cd ..
6269
./autogen.sh # not required when building from tarball
63-
./configure --prefix=`pwd`/depends/i686-w64-mingw32
70+
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/
6471
make
6572

66-
To build executables for Windows 64-bit:
73+
## Building for 32-bit Windows
74+
75+
To build executables for Windows 32-bit, install the following dependencies:
76+
77+
sudo apt-get install g++-mingw-w64-i686 mingw-w64-i686-dev
78+
79+
Then build using:
6780

6881
cd depends
69-
make HOST=x86_64-w64-mingw32 -j4
82+
make HOST=i686-w64-mingw32 -j4
7083
cd ..
7184
./autogen.sh # not required when building from tarball
72-
./configure --prefix=`pwd`/depends/x86_64-w64-mingw32
85+
CONFIG_SITE=$PWD/depends/i686-w64-mingw32/share/config.site ./configure --prefix=/
7386
make
7487

88+
## Depends system
89+
7590
For further documentation on the depends system see [README.md](../depends/README.md) in the depends directory.
91+
92+
Installation
93+
-------------
94+
95+
After building using the Windows subsystem it can be useful to copy the compiled
96+
executables to a directory on the windows drive in the same directory structure
97+
as they appear in the release `.zip` archive. This can be done in the following
98+
way. This will install to `c:\workspace\bitcoin`, for example:
99+
100+
make install DESTDIR=/mnt/c/workspace/bitcoin
101+

0 commit comments

Comments
 (0)