Changeset View
Changeset View
Standalone View
Standalone View
doc/build-windows.md
WINDOWS BUILD NOTES | WINDOWS BUILD NOTES | ||||
==================== | ==================== | ||||
Below are some notes on how to build Bitcoin ABC for Windows. | Below are some notes on how to build Bitcoin ABC for Windows. | ||||
The options known to work for building Bitcoin ABC on Windows are: | The options known to work for building Bitcoin ABC on Windows are: | ||||
* On Linux using the [Mingw-w64](https://mingw-w64.org/doku.php) cross compiler tool chain. Ubuntu Trusty 14.04 is recommended | * On Linux, using the [Mingw-w64](https://mingw-w64.org/doku.php) cross compiler tool chain. Ubuntu Trusty 14.04 is recommended | ||||
and is the platform used to build the Bitcoin ABC Windows release binaries. | and is the platform used to build the Bitcoin ABC Windows release binaries. | ||||
* On Windows using [Windows | * On Windows, using [Windows | ||||
Subsystem for Linux (WSL)](https://msdn.microsoft.com/commandline/wsl/about) and the Mingw-w64 cross compiler tool chain. | Subsystem for Linux (WSL)](https://msdn.microsoft.com/commandline/wsl/about) and the Mingw-w64 cross compiler tool chain. | ||||
Other options which may work, but which have not been extensively tested are (please contribute instructions): | Other options which may work, but which have not been extensively tested are (please contribute instructions): | ||||
* On Windows using a POSIX compatibility layer application such as [cygwin](http://www.cygwin.com/) or [msys2](http://www.msys2.org/). | * On Windows, using a POSIX compatibility layer application such as [cygwin](http://www.cygwin.com/) or [msys2](http://www.msys2.org/). | ||||
* On Windows using a native compiler tool chain such as [Visual Studio](https://www.visualstudio.com). | * On Windows, using a native compiler tool chain such as [Visual Studio](https://www.visualstudio.com). | ||||
In any case please make sure that the compiler supports C++14. | In any case please make sure that the compiler supports C++14. | ||||
Installing Windows Subsystem for Linux | Installing Windows Subsystem for Linux | ||||
--------------------------------------- | --------------------------------------- | ||||
With Windows 10, Microsoft has released a new feature named the [Windows | With Windows 10, Microsoft has released a new feature named the [Windows | ||||
Subsystem for Linux (WSL)](https://msdn.microsoft.com/commandline/wsl/about). This | Subsystem for Linux (WSL)](https://msdn.microsoft.com/commandline/wsl/about). This | ||||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | |||||
Ubuntu Artful 17.10 <sup>[2](#footnote2)</sup>: | Ubuntu Artful 17.10 <sup>[2](#footnote2)</sup>: | ||||
sudo update-alternatives --config x86_64-w64-mingw32-g++ # Set the default mingw32 g++ compiler option to posix. | sudo update-alternatives --config x86_64-w64-mingw32-g++ # Set the default mingw32 g++ compiler option to posix. | ||||
Once the toolchain is installed the build steps are common: | Once the toolchain is installed the build steps are common: | ||||
Note that for WSL the Bitcoin ABC source path MUST be somewhere in the default mount file system, for | Note that for WSL the Bitcoin ABC source path MUST be somewhere in the default mount file system, for | ||||
example /usr/src/bitcoin-abc, AND not under /mnt/d/. If this is not the case the dependency autoconf scripts will fail. | example /usr/src/bitcoin-abc, AND not under /mnt/d/. If this is not the case the dependency autoconf scripts will fail. | ||||
This means you cannot use a directory that located directly on the host Windows file system to perform the build. | This means you cannot use a directory that is located directly on the host Windows file system to perform the build. | ||||
Acquire the source in the usual way: | Acquire the source in the usual way: | ||||
git clone https://github.com/Bitcoin-ABC/bitcoin-abc.git | git clone https://github.com/Bitcoin-ABC/bitcoin-abc.git | ||||
Once the source code is ready the build steps are below. | Once the source code is ready the build steps are below: | ||||
PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g') # strip out problematic Windows %PATH% imported var | PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g') # strip out problematic Windows %PATH% imported var | ||||
cd depends | cd depends | ||||
make HOST=x86_64-w64-mingw32 | make HOST=x86_64-w64-mingw32 | ||||
cd .. | cd .. | ||||
./autogen.sh # not required when building from tarball | ./autogen.sh # not required when building from tarball | ||||
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/ --with-seeder=false # seeder not supported in Windows yet | CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/ --with-seeder=false # seeder not supported in Windows yet | ||||
make | make | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
<a name="footnote1">1</a>: There is currently a bug in the 64 bit Mingw-w64 cross compiler packaged for WSL/Ubuntu Xenial 16.04 that | <a name="footnote1">1</a>: There is currently a bug in the 64 bit Mingw-w64 cross compiler packaged for WSL/Ubuntu Xenial 16.04 that | ||||
causes two of the bitcoin executables to crash shortly after start up. The bug is related to the | causes two of the bitcoin executables to crash shortly after start up. The bug is related to the | ||||
-fstack-protector-all g++ compiler flag which is used to mitigate buffer overflows. | -fstack-protector-all g++ compiler flag which is used to mitigate buffer overflows. | ||||
Installing the Mingw-w64 packages from the Ubuntu 17.10 distribution solves the issue, however, this is not | Installing the Mingw-w64 packages from the Ubuntu 17.10 distribution solves the issue, however, this is not | ||||
an officially supported approach and it's only recommended if you are prepared to reinstall WSL/Ubuntu should | an officially supported approach and it's only recommended if you are prepared to reinstall WSL/Ubuntu should | ||||
something break. | something break. | ||||
<a name="footnote2">2</a>: Starting from Ubuntu Xenial 16.04 both the 32 and 64 bit Mingw-w64 packages install two different | <a name="footnote2">2</a>: Starting from Ubuntu Xenial 16.04, both the 32 and 64 bit Mingw-w64 packages install two different | ||||
compiler options to allow a choice between either posix or win32 threads. The default option is win32 threads which is the more | compiler options to allow a choice between either posix or win32 threads. The default option is win32 threads which is the more | ||||
efficient since it will result in binary code that links directly with the Windows kernel32.lib. Unfortunately, the headers | efficient since it will result in binary code that links directly with the Windows kernel32.lib. Unfortunately, the headers | ||||
required to support win32 threads conflict with some of the classes in the C++11 standard library in particular std::mutex. | required to support win32 threads conflict with some of the classes in the C++11 standard library, in particular std::mutex. | ||||
It's not possible to build the Bitcoin ABC code using the win32 version of the Mingw-w64 cross compilers (at least not without | It's not possible to build the Bitcoin ABC code using the win32 version of the Mingw-w64 cross compilers (at least not without | ||||
modifying headers in the Bitcoin ABC source code). | modifying headers in the Bitcoin ABC source code). |