Skip to content

Commit c1b7332

Browse files
committed
Merge bitcoin#28934: ci: Set MSVC toolset version explicitly
70100f8 Revert "ci: Avoid toolset ambiguity that MSVC can't handle" (Hennadii Stepanov) 1a889f7 ci: Set MSVC toolset version explicitly (Hennadii Stepanov) 4335e55 ci: Run vcpkg with path prefix (Hennadii Stepanov) Pull request description: This PR is an alternative to bitcoin#28905 and reverts it. To avoid toolset version incompatibilities, which result in errors like this: ``` LINK : fatal error C1900: Il mismatch between 'P1' version '20230904' and 'P2' version '20221215' [D:\a\bitcoin\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj] LINK : fatal error LNK1257: code generation failed [D:\a\bitcoin\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj] LINK : fatal error LNK1327: failure during running link.exe [D:\a\bitcoin\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj] ``` it is enough to set it explicitly in the vcpkg triplet file (see the second commit). The `VCToolsVersion` environment variable is set by the `ilammy/msvc-dev-cmd` action. Please note that the bitcoin#28905 is not [optimal](bitcoin#28905 (comment)): > I guess this is something we'll just have to maintain forever? That's a shame, because it also adds ~30% runtime to this CI job. ACKs for top commit: sipsorcery: utACK 70100f8. pablomartin4btc: ACK 70100f8 since I've reviewed to be reverted bitcoin#28905. Tree-SHA512: 121a8e40c728060526f380b7946211b5d4eca8821bfe62e6451642ffdf95fe9ab7101e0cffa7f4a777bc9cf94278bb50c1b40b71768e1ac39801bb4831afeb90
2 parents 794f971 + 70100f8 commit c1b7332

File tree

1 file changed

+5
-51
lines changed

1 file changed

+5
-51
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -138,55 +138,6 @@ jobs:
138138
- name: Checkout
139139
uses: actions/checkout@v4
140140

141-
- name: Fix Visual Studio installation
142-
# Avoid toolset ambiguity that MSVC can't handle.
143-
run: |
144-
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
145-
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
146-
$componentsToRemove= @(
147-
"Microsoft.VisualStudio.Component.VC.14.37.17.7.ARM.Spectre"
148-
"Microsoft.VisualStudio.Component.VC.14.37.17.7.ARM"
149-
"Microsoft.VisualStudio.Component.VC.14.37.17.7.ARM64.Spectre"
150-
"Microsoft.VisualStudio.Component.VC.14.37.17.7.ARM64"
151-
"Microsoft.VisualStudio.Component.VC.14.37.17.7.ATL.ARM.Spectre"
152-
"Microsoft.VisualStudio.Component.VC.14.37.17.7.ATL.ARM"
153-
"Microsoft.VisualStudio.Component.VC.14.37.17.7.ATL.ARM64.Spectre"
154-
"Microsoft.VisualStudio.Component.VC.14.37.17.7.ATL.ARM64"
155-
"Microsoft.VisualStudio.Component.VC.14.37.17.7.ATL.Spectre"
156-
"Microsoft.VisualStudio.Component.VC.14.37.17.7.ATL"
157-
"Microsoft.VisualStudio.Component.VC.14.37.17.7.MFC.ARM.Spectre"
158-
"Microsoft.VisualStudio.Component.VC.14.37.17.7.MFC.ARM"
159-
"Microsoft.VisualStudio.Component.VC.14.37.17.7.MFC.ARM64.Spectre"
160-
"Microsoft.VisualStudio.Component.VC.14.37.17.7.MFC.ARM64"
161-
"Microsoft.VisualStudio.Component.VC.14.37.17.7.MFC.Spectre"
162-
"Microsoft.VisualStudio.Component.VC.14.37.17.7.MFC"
163-
"Microsoft.VisualStudio.Component.VC.14.37.17.7.x86.x64.Spectre"
164-
"Microsoft.VisualStudio.Component.VC.14.37.17.7.x86.x64"
165-
"Microsoft.VisualStudio.Component.VC.14.38.17.8.ARM"
166-
"Microsoft.VisualStudio.Component.VC.14.38.17.8.ARM.Spectre"
167-
"Microsoft.VisualStudio.Component.VC.14.38.17.8.ARM64"
168-
"Microsoft.VisualStudio.Component.VC.14.38.17.8.ARM64.Spectre"
169-
"Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL"
170-
"Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.ARM"
171-
"Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.ARM.Spectre"
172-
"Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.ARM64"
173-
"Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.ARM64.Spectre"
174-
"Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.Spectre"
175-
"Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC"
176-
"Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.ARM"
177-
"Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.ARM.Spectre"
178-
"Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.ARM64"
179-
"Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.ARM64.Spectre"
180-
"Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.Spectre"
181-
"Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64"
182-
"Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64.Spectre"
183-
)
184-
[string]$workloadArgs = $componentsToRemove | ForEach-Object {" --remove " + $_}
185-
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
186-
# should be run twice
187-
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
188-
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
189-
190141
- name: Configure Developer Command Prompt for Microsoft Visual C++
191142
# Using microsoft/setup-msbuild is not enough.
192143
uses: ilammy/msvc-dev-cmd@v1
@@ -197,6 +148,8 @@ jobs:
197148
run: |
198149
msbuild -version | Out-File -FilePath "$env:GITHUB_WORKSPACE\msbuild_version"
199150
Get-Content -Path "$env:GITHUB_WORKSPACE\msbuild_version"
151+
$env:VCToolsVersion | Out-File -FilePath "$env:GITHUB_WORKSPACE\toolset_version"
152+
Get-Content -Path "$env:GITHUB_WORKSPACE\toolset_version"
200153
$env:CI_QT_URL | Out-File -FilePath "$env:GITHUB_WORKSPACE\qt_url"
201154
$env:CI_QT_CONF | Out-File -FilePath "$env:GITHUB_WORKSPACE\qt_conf"
202155
@@ -279,7 +232,8 @@ jobs:
279232
run: |
280233
Set-Location "$env:VCPKG_INSTALLATION_ROOT"
281234
Add-Content -Path "triplets\x64-windows-static.cmake" -Value "set(VCPKG_BUILD_TYPE release)"
282-
vcpkg --vcpkg-root "$env:VCPKG_INSTALLATION_ROOT" integrate install
235+
Add-Content -Path "triplets\x64-windows-static.cmake" -Value "set(VCPKG_PLATFORM_TOOLSET_VERSION $env:VCToolsVersion)"
236+
.\vcpkg.exe --vcpkg-root "$env:VCPKG_INSTALLATION_ROOT" integrate install
283237
git rev-parse HEAD | Out-File -FilePath "$env:GITHUB_WORKSPACE\vcpkg_commit"
284238
Get-Content -Path "$env:GITHUB_WORKSPACE\vcpkg_commit"
285239
@@ -293,7 +247,7 @@ jobs:
293247
uses: actions/cache@v3
294248
with:
295249
path: ~/AppData/Local/vcpkg/archives
296-
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('vcpkg_commit', 'msbuild_version', 'build_msvc/vcpkg.json') }}
250+
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('vcpkg_commit', 'msbuild_version', 'toolset_version', 'build_msvc/vcpkg.json') }}
297251

298252
- name: Generate project files
299253
run: py -3 build_msvc\msvc-autogen.py

0 commit comments

Comments
 (0)