Skip to content

Commit 0a1af44

Browse files
committed
doc: Add workaround for vcpkg issue with paths with embedded spaces
1 parent a92e8b1 commit 0a1af44

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

doc/build-windows-msvc.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,6 @@ ctest --test-dir build --build-config Release # Append "-j N" for N parallel te
5959
cmake --install build --config Release # Optional.
6060
```
6161

62-
If building with `BUILD_GUI=ON`, vcpkg installation during the build
63-
configuration step might fail because of extremely long paths required during
64-
vcpkg installation if your vcpkg instance is installed in the default Visual
65-
Studio directory. This can be avoided without modifying your vcpkg root
66-
directory by changing vcpkg's intermediate build directory with the
67-
`--x-buildtrees-root` argument to something shorter, for example:
68-
69-
```powershell
70-
cmake -B build --preset vs2022-static -DVCPKG_INSTALL_OPTIONS="--x-buildtrees-root=C:\vcpkg"
71-
```
72-
7362
### 5. Building with Dynamic Linking without GUI
7463

7564
```
@@ -78,9 +67,30 @@ cmake --build build --config Release # Append "-j N" for N parallel jo
7867
ctest --test-dir build --build-config Release # Append "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available.
7968
```
8069

70+
### 6. vcpkg-specific Issues and Workarounds
71+
72+
vcpkg installation during the configuration step might fail for various reasons unrelated to Bitcoin Core.
73+
74+
If the failure is due to a "Buildtrees path … is too long" error, which is often encountered when building
75+
with `BUILD_GUI=ON` and using the default vcpkg installation provided by Visual Studio, you can
76+
specify a shorter path to store intermediate build files by using
77+
the [`--x-buildtrees-root`](https://learn.microsoft.com/en-us/vcpkg/commands/common-options#buildtrees-root) option:
78+
79+
```powershell
80+
cmake -B build --preset vs2022-static -DVCPKG_INSTALL_OPTIONS="--x-buildtrees-root=C:\vcpkg"
81+
```
82+
83+
If vcpkg installation fails with the message "Paths with embedded space may be handled incorrectly", which
84+
can occur if your local Bitcoin Core repository path contains spaces, you can override the vcpkg install directory
85+
by setting the [`VCPKG_INSTALLED_DIR`](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/users/buildsystems/cmake-integration.md#vcpkg_installed_dir) variable:
86+
87+
```powershell
88+
cmake -B build --preset vs2022-static -DVCPKG_INSTALLED_DIR="C:\path_without_spaces"
89+
```
90+
8191
## Performance Notes
8292

83-
### 6. vcpkg Manifest Default Features
93+
### 7. vcpkg Manifest Default Features
8494

8595
One can skip vcpkg manifest default features to speedup the configuration step.
8696
For example, the following invocation will skip all features except for "wallet" and "tests" and their dependencies:
@@ -90,6 +100,6 @@ cmake -B build --preset vs2022 -DVCPKG_MANIFEST_NO_DEFAULT_FEATURES=ON -DVCPKG_M
90100

91101
Available features are listed in the [`vcpkg.json`](/vcpkg.json) file.
92102

93-
### 7. Antivirus Software
103+
### 8. Antivirus Software
94104

95105
To improve the build process performance, one might add the Bitcoin repository directory to the Microsoft Defender Antivirus exclusions.

0 commit comments

Comments
 (0)