Skip to content

Commit 8a90998

Browse files
authored
Merge pull request #2383 from barton2526/windows-build
doc: Update Windows build instructions
2 parents 00b8522 + d8e9967 commit 8a90998

File tree

1 file changed

+25
-41
lines changed

1 file changed

+25
-41
lines changed

doc/build-windows.md

Lines changed: 25 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ Below are some notes on how to build Gridcoin for Windows.
55

66
The options known to work for building Gridcoin on Windows are:
77

8-
* On Linux, using the [Mingw-w64](https://mingw-w64.org/doku.php) cross compiler tool chain. Ubuntu Bionic 18.04 is required
9-
and is the platform used to build the Gridcoin Windows release binaries.
10-
* On Windows, using [Windows
11-
Subsystem for Linux (WSL)](https://docs.microsoft.com/windows/wsl/about) and the Mingw-w64 cross compiler tool chain.
12-
* On Windows, using a native compiler tool chain such as [Visual Studio](https://www.visualstudio.com).
8+
* On Linux, using the [Mingw-w64](https://www.mingw-w64.org/) cross compiler tool chain.
9+
* On Windows, using [Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/windows/wsl/about) and Mingw-w64.
1310

1411
Other options which may work, but which have not been extensively tested are (please contribute instructions):
1512

@@ -18,35 +15,7 @@ Other options which may work, but which have not been extensively tested are (pl
1815
Installing Windows Subsystem for Linux
1916
---------------------------------------
2017

21-
With Windows 10, Microsoft has released a new feature named the [Windows
22-
Subsystem for Linux (WSL)](https://docs.microsoft.com/windows/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. Note that while WSL can be installed with
26-
other Linux variants, such as OpenSUSE, the following instructions have only been
27-
tested with Ubuntu.
28-
29-
This feature is not supported in versions of Windows prior to Windows 10 or on
30-
Windows Server SKUs. In addition, it is available [only for 64-bit versions of
31-
Windows](https://docs.microsoft.com/windows/wsl/install-win10).
32-
33-
Full instructions to install WSL are available on the above link.
34-
To install WSL on Windows 10 with Fall Creators Update installed (version >= 16215.0) do the following:
35-
36-
1. Enable the Windows Subsystem for Linux feature
37-
* Open the Windows Features dialog (`OptionalFeatures.exe`)
38-
* Enable 'Windows Subsystem for Linux'
39-
* Click 'OK' and restart if necessary
40-
2. Install Ubuntu
41-
* Open Microsoft Store and search for "Ubuntu 18.04" or use [this link](https://www.microsoft.com/store/productId/9N9TNGVNDL3Q)
42-
* Click Install
43-
3. Complete Installation
44-
* Open a cmd prompt and type "Ubuntu1804"
45-
* Create a new UNIX user account (this is a separate account from your Windows account)
46-
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.
18+
Follow the upstream installation instructions, available [here](https://docs.microsoft.com/windows/wsl/install-win10).
5019

5120
Cross-compilation for Ubuntu and Windows Subsystem for Linux
5221
------------------------------------------------------------
@@ -80,9 +49,24 @@ The first step is to install the mingw-w64 cross-compilation tool chain:
8049

8150
sudo apt install g++-mingw-w64-x86-64
8251

83-
Ubuntu Bionic 18.04:
52+
Next, set the default `mingw32 g++` compiler option to POSIX:
8453

85-
sudo update-alternatives --config x86_64-w64-mingw32-g++ # Set the default mingw32 g++ compiler option to posix.
54+
```
55+
sudo update-alternatives --config x86_64-w64-mingw32-g++
56+
```
57+
58+
After running the above command, you should see output similar to that below.
59+
Choose the option that ends with `posix`.
60+
61+
```
62+
There are 2 choices for the alternative x86_64-w64-mingw32-g++ (providing /usr/bin/x86_64-w64-mingw32-g++).
63+
Selection Path Priority Status
64+
------------------------------------------------------------
65+
0 /usr/bin/x86_64-w64-mingw32-g++-win32 60 auto mode
66+
* 1 /usr/bin/x86_64-w64-mingw32-g++-posix 30 manual mode
67+
2 /usr/bin/x86_64-w64-mingw32-g++-win32 60 manual mode
68+
Press <enter> to keep the current choice[*], or type selection number:
69+
```
8670

8771
Once the toolchain is installed the build steps are common:
8872

@@ -102,9 +86,9 @@ Build using:
10286
cd depends
10387
make HOST=x86_64-w64-mingw32
10488
cd ..
105-
./autogen.sh # not required when building from tarball
89+
./autogen.sh
10690
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/
107-
make
91+
make # use "-j N" for N parallel jobs
10892
sudo bash -c "echo 1 > /proc/sys/fs/binfmt_misc/status" # Enable WSL support for Win32 applications.
10993

11094
## Building for 32-bit Windows
@@ -113,7 +97,7 @@ To build executables for Windows 32-bit, install the following dependencies:
11397

11498
sudo apt-get install g++-mingw-w64-i686 mingw-w64-i686-dev
11599

116-
For Ubuntu Xenial 16.04, Ubuntu Zesty 17.04 and Windows Subsystem for Linux:
100+
Next, set the default `mingw32 g++` compiler option to POSIX:
117101

118102
sudo update-alternatives --config i686-w64-mingw32-g++ # Set the default mingw32 g++ compiler option to posix.
119103

@@ -131,9 +115,9 @@ Then build using:
131115
cd depends
132116
make HOST=i686-w64-mingw32
133117
cd ..
134-
./autogen.sh # not required when building from tarball
118+
./autogen.sh
135119
CONFIG_SITE=$PWD/depends/i686-w64-mingw32/share/config.site ./configure --prefix=/
136-
make
120+
make # use "-j N" for N parallel jobs
137121
sudo bash -c "echo 1 > /proc/sys/fs/binfmt_misc/status" # Enable WSL support for Win32 applications.
138122

139123
## Depends system

0 commit comments

Comments
 (0)