You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bitcoin/build_msvc
W. J. van der Laan 36aee0f353
Merge bitcoin-core/gui#381: refactor: Make BitcoinCore class reusable
3 years ago
..
bench_bitcoin Added libtest_util library to msvc build configuration. 5 years ago
bitcoin-cli [MSVC] Copy build output to src/ automatically after build 5 years ago
bitcoin-qt build: Fix MSVC linker /SubSystem option for bitcoin-qt.exe 3 years ago
bitcoin-tx [MSVC] Copy build output to src/ automatically after build 5 years ago
bitcoin-util build_msvc: Add bitcoin-util.exe 3 years ago
bitcoin-wallet [MSVC] Copy build output to src/ automatically after build 5 years ago
bitcoind multiprocess: Add bitcoin-node process spawning support 4 years ago
libbitcoin_cli [MSVC] Copy build output to src/ automatically after build 5 years ago
libbitcoin_common [MSVC] Copy build output to src/ automatically after build 5 years ago
libbitcoin_crypto [MSVC] Copy build output to src/ automatically after build 5 years ago
libbitcoin_qt qt, refactor: Move InitExecutor class into its own module 3 years ago
libbitcoin_server [MSVC] Copy build output to src/ automatically after build 5 years ago
libbitcoin_util Drop unintended bitcoin-tx dependency on libevent 5 years ago
libbitcoin_wallet Do not compile BDB things when USE_BDB is defined 4 years ago
libbitcoin_wallet_tool [MSVC] Copy build output to src/ automatically after build 5 years ago
libbitcoin_zmq [MSVC] Copy build output to src/ automatically after build 5 years ago
libbitcoinconsensus [MSVC] Copy build output to src/ automatically after build 5 years ago
libleveldb build: Enable safe warnings for msvc builds 4 years ago
libsecp256k1 Disable certain false positive warnings for libsecp256k1 msvc build 4 years ago
libtest_util Added libtest_util library to msvc build configuration. 5 years ago
libunivalue [MSVC] Copy build output to src/ automatically after build 5 years ago
msbuild/tasks [MSVC]: Create the config.ini as part of bitcoind build 5 years ago
test_bitcoin build: Fix appveyor test_bitcoin build of *.raw 5 years ago
test_bitcoin-qt test: remove qt byteswap compattests 4 years ago
testconsensus refactor: Replace &foo[0] with foo.data() 4 years ago
.gitignore Update msvc build to use new vcpkg manifest 4 years ago
README.md Remove Visual Studio 2017 reference from readme 4 years ago
bitcoin.sln build_msvc: Add bitcoin-util.exe 3 years ago
bitcoin_config.h build: Bump master version to 22.99.0 3 years ago
common.init.vcxproj Merge bitcoin/bitcoin#21045: build: adds switch to enable/disable randomized base address in MSVC builds 4 years ago
common.qt.init.vcxproj Update msvc and appveyor builds to use Qt5.12.11 binaries. 3 years ago
common.vcxproj Adjusted msvc compiler and linker settings to remove optimisations that are causing sporadic ABI issues on Visual Studio updates. 4 years ago
libsecp256k1_config.h Update MSVC build config for libsecp256k1 4 years ago
msvc-autogen.py test: fix file permissions on various scripts 4 years ago
vcpkg.json ci: remove boost thread installation 4 years ago

README.md

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 .appveyor.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.

AppVeyor

The .appveyor.yml in the root directory is suitable to perform builds on AppVeyor Continuous Integration servers. The simplest way to perform an AppVeyor build is to fork Bitcoin Core and then configure a new AppVeyor Project pointing to the forked repository.

For safety reasons the Bitcoin Core .appveyor.yml file has the artifact options disabled. The build will be performed but no executable files will be available. To enable artifacts on a forked repository uncomment the lines shown below:

    #- 7z a bitcoin-%APPVEYOR_BUILD_VERSION%.zip %APPVEYOR_BUILD_FOLDER%\build_msvc\%platform%\%configuration%\*.exe
    #- path: bitcoin-%APPVEYOR_BUILD_VERSION%.zip

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.