bitcoin/build_msvc
2021-09-07 06:12:53 +03:00
..
bench_bitcoin
bitcoin-cli
bitcoin-qt build: Fix MSVC linker /SubSystem option for bitcoin-qt.exe 2021-06-12 17:13:27 +03:00
bitcoin-tx
bitcoin-util build_msvc: Add bitcoin-util.exe 2021-06-18 20:08:06 +02:00
bitcoin-wallet
bitcoind multiprocess: Add bitcoin-node process spawning support 2021-04-23 03:02:50 -05:00
libbitcoin_cli
libbitcoin_common
libbitcoin_crypto
libbitcoin_qt qt, refactor: Move InitExecutor class into its own module 2021-07-14 21:54:32 +03:00
libbitcoin_server
libbitcoin_util
libbitcoin_wallet
libbitcoin_wallet_tool
libbitcoin_zmq
libbitcoinconsensus
libleveldb build: Enable safe warnings for msvc builds 2021-03-29 11:01:19 +03:00
libsecp256k1 Disable certain false positive warnings for libsecp256k1 msvc build 2021-04-02 13:17:49 -07:00
libtest_util
libunivalue
msbuild/tasks
test_bitcoin wallet test refactor: add CreateSyncedWallet function 2021-06-12 11:22:41 -04:00
test_bitcoin-qt test: remove qt byteswap compattests 2021-03-29 11:12:26 +08:00
testconsensus refactor: Replace &foo[0] with foo.data() 2021-05-04 06:55:31 +02:00
.gitignore
bitcoin_config.h msvc: update bitcoin_config.h defines 2021-09-02 11:14:18 +08:00
bitcoin.sln build_msvc: Add bitcoin-util.exe 2021-06-18 20:08:06 +02:00
common.init.vcxproj Merge bitcoin/bitcoin#21045: build: adds switch to enable/disable randomized base address in MSVC builds 2021-04-29 22:14:34 +02:00
common.qt.init.vcxproj ci: Add Windows task to Cirrus CI 2021-09-07 06:12:51 +03:00
common.vcxproj Adjusted msvc compiler and linker settings to remove optimisations that are causing sporadic ABI issues on Visual Studio updates. 2020-12-02 11:39:01 +00:00
libsecp256k1_config.h
msvc-autogen.py build: Update default platform toolset in msvc-autogen.py 2021-09-04 15:34:58 +03:00
README.md ci: Drop AppVeyor CI integration 2021-09-07 06:12:53 +03:00
vcpkg.json ci: remove boost thread installation 2021-02-02 12:38:22 +08:00

Building Bitcoin Core with Visual Studio

Introduction

Solution and project files to build the Bitcoin Core applications msbuild or Visual Studio can be found in the build_msvc directory. The build has been tested with Visual Studio 2019 (building with earlier versions of Visual Studio should not be expected to work).

Building with Visual Studio is an alternative to the Linux based cross-compiler build.

Quick Start

The minimal steps required to build Bitcoin Core with the msbuild toolchain are below. More detailed instructions are contained in the following sections.

cd build_msvc
py -3 msvc-autogen.py
msbuild /m bitcoin.sln /p:Platform=x64 /p:Configuration=Release /t:build

Dependencies

A number of open source libraries are required in order to be able to build Bitcoin Core.

Options for installing the dependencies in a Visual Studio compatible manner are:

  • Use Microsoft's vcpkg to download the source packages and build locally. This is the recommended approach.
  • Download the source code, build each dependency, add the required include paths, link libraries and binary tools to the Visual Studio project files.
  • Use nuget packages with the understanding that any binary files have been compiled by an untrusted third party.

The external dependencies required for building are listed in the build_msvc/vcpkg.json file. To ensure msbuild project files automatically install the vcpkg dependencies use:

vcpkg integrate install

Qt

In order to build Bitcoin Core a static build of Qt is required. The runtime library version (e.g. v142) and platform type (x86 or x64) must also match.

Some prebuilt x64 versions of Qt can be downloaded from here. Please be aware these downloads are NOT officially sanctioned by Bitcoin Core and are provided for developer convenience only. They should NOT be used for builds that will be used in a production environment or with real funds.

To determine which Qt prebuilt version to download open the .cirrus.yml file and note the QT_DOWNLOAD_URL. When extracting the zip file the destination path must be set to C:\. This is due to the way that Qt includes, libraries and tools use internal paths.

To build Bitcoin Core without Qt unload or disable the bitcoin-qt, libbitcoin_qt and test_bitcoin-qt projects.

Building

The instructions below use vcpkg to install the dependencies.

  • Install vcpkg.

  • Use Python to generate *.vcxproj from Makefile

PS >py -3 msvc-autogen.py
  • An optional step is to adjust the settings in the build_msvc directory and the common.init.vcxproj file. This project file contains settings that are common to all projects such as the runtime library version and target Windows SDK version. The Qt directories can also be set.

  • To build from the command line with the Visual Studio 2019 toolchain use:

msbuild /m bitcoin.sln /p:Platform=x64 /p:Configuration=Release /t:build
  • Alternatively, open the build_msvc/bitcoin.sln file in Visual Studio 2019.

Security

Base address randomization is used to make Bitcoin Core more secure. When building Bitcoin using the build_msvc process base address randomization can be disabled by editing common.init.vcproj to change RandomizedBaseAddress from true to false and then rebuilding the project.

To check if bitcoind has RandomizedBaseAddress enabled or disabled run

.\dumpbin.exe /headers src/bitcoind.exe

If is it enabled then in the output Dynamic base will be listed in the DLL characteristics under OPTIONAL HEADER VALUES as shown below

            8160 DLL characteristics
                   High Entropy Virtual Addresses
                   Dynamic base
                   NX compatible
                   Terminal Server Aware

This may not disable all stack randomization as versions of windows employ additional stack randomization protections. These protections must be turned off in the OS configuration.