Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ / MSBuild not using latest toolset #7487

Closed
2 of 9 tasks
marc2k3 opened this issue Apr 25, 2023 · 13 comments
Closed
2 of 9 tasks

C++ / MSBuild not using latest toolset #7487

marc2k3 opened this issue Apr 25, 2023 · 13 comments
Assignees
Labels
Area: Common Tools awaiting-deployment Code complete; awaiting deployment and/or deployment in progress bug report OS: Windows

Comments

@marc2k3
Copy link

marc2k3 commented Apr 25, 2023

Description

VS 2022 17.5 should be using the latest 14.35 toolset but it's not.

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 20.04
  • Ubuntu 22.04
  • macOS 11
  • macOS 12
  • Windows Server 2019
  • Windows Server 2022

Image version and build link

Image: windows-2022
Version: 20230417.1
Included Software: https://github.com/actions/runner-images/blob/win22/20230417.1/images/win/Windows2022-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/win22%2F20230417.1

Is it regression?

No

Expected behavior

Expecting the latest 14.35 toolset to be used.

Actual behavior

14.34 toolset is being used as can be seen here...

https://github.com/marc2k3/foo_musicbrainz64/actions/runs/4796230044/jobs/8531766018#step:6:562

Repro steps

This causes the build to error here...

https://github.com/marc2k3/foo_musicbrainz64/actions/runs/4796230044/jobs/8531766018#step:6:570

2>D:\a\foo_musicbrainz64\foo_musicbrainz64\src\ReleaseParser.cpp(268,50):
error C2039: 'fold_left': is not a member of 'std::ranges' [D:\a\foo_musicbrainz64\foo_musicbrainz64\src\foo_musicbrainz64.vcxproj]

I'm using /std:c++latest expecting the latest std::ranges toys like fold_left, zip_view etc to work.

@ilia-shipitsin
Copy link
Contributor

Hello @marc2k3 , I'll have a look

@ilia-shipitsin
Copy link
Contributor

so far, 14.35.32215 is shipped with image (I wonder why latest didn't pick it). let us figure out...

image

@ilia-shipitsin
Copy link
Contributor

using the following snippet

    - name: 'list vc tools'
      run: |
        get-childitem -Path 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC'
        get-content 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\Microsoft.VCToolsVersion.v143.default.props'

it turns out that 14.34.31931 is used for v143 (I'll try to figure out why)

image

@marc2k3
Copy link
Author

marc2k3 commented Apr 25, 2023

Thanks for looking in to this. I was able to override the VCToolsVersion in my .vcxproj and the build now succeeds...

https://github.com/marc2k3/foo_musicbrainz64/commit/5ac296551a3d270f6f93561a93c84b8e42288eb8

diff --git a/src/foo_musicbrainz64.vcxproj b/src/foo_musicbrainz64.vcxproj
index 4d4755a..925f188 100644
--- a/src/foo_musicbrainz64.vcxproj
+++ b/src/foo_musicbrainz64.vcxproj
@@ -23,6 +23,7 @@
     <UseDebugLibraries>true</UseDebugLibraries>
     <PlatformToolset>v143</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
+    <VCToolsVersion>14.35.32215</VCToolsVersion>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
@@ -30,6 +31,7 @@
     <PlatformToolset>v143</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
+    <VCToolsVersion>14.35.32215</VCToolsVersion>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings" />

Successful build: https://github.com/marc2k3/foo_musicbrainz64/actions/runs/4801242199

@ilia-shipitsin
Copy link
Contributor

ilia-shipitsin commented Apr 25, 2023

I've found that we install several VS workloads, couple of them are v143, namely Microsoft.VisualStudio.Component.VC.14.34.17.4.x86.x64 and Microsoft.VisualStudio.Component.VC.Tools.x86.x64, thus we do not control which one of them actually wins.

we'll address it in some way. thanks for finding!

@ilia-shipitsin
Copy link
Contributor

as a side note, /std:c++latest does not specify the latest toolset available (for example, you may specify v141), it means "use all experimental features in chosen toolset" :)

@marc2k3
Copy link
Author

marc2k3 commented Apr 25, 2023

Using Microsoft.VisualStudio.Component.VC.Tools.x86.x64 as a search term is not found in the toolset-2022.json you linked to.

If you search for just Microsoft.VisualStudio.Component.VC.Tools, you get this without the x86.x64.

image

ozone10 referenced this issue in chcg/notepad-plus-plus Apr 30, 2023
- cmake
- ubuntu linux
- clang-cl toolchain
- use ms analysis
@mikhailkoliada mikhailkoliada added the awaiting-deployment Code complete; awaiting deployment and/or deployment in progress label May 11, 2023
@marc2k3
Copy link
Author

marc2k3 commented Jun 3, 2023

I see this is fixed now. Thanks.

@marc2k3 marc2k3 closed this as completed Jun 3, 2023
@alastairUK
Copy link

Has this been deployed? I am still seeing 14.34 being used for my C++ projects using MSBuild.

@marc2k3
Copy link
Author

marc2k3 commented Jun 5, 2023

I ran this just now...

VS 17.6.3 here: https://github.com/marc2k3/foo_input_ofr/actions/runs/5175984478/jobs/9324251598#step:7:8
Toolset version 14.35 here: https://github.com/marc2k3/foo_input_ofr/actions/runs/5175984478/jobs/9324251598#step:7:25

It would be nice if it was on 14.36 to match VS 17.6 though!

edit: totally irrelevant for that linked project, it doesn't use any modern C++ at all. It's just the one public repo I have right now.

@alastairUK
Copy link

I'm using Azure DevOps so that could be the difference.

Operating System
Microsoft Windows Server 2022
10.0.20348
Datacenter
Runner Image
Image: windows-2022
Version: 20230508.3
Included Software: https://github.com/actions/runner-images/blob/win22/20230508.3/images/win/Windows2022-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/win22%2F20230508.3

ClCompile:
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\bin\HostX86\x86\CL.exe /c /I..

This is using MSBuild but a CMake project I've tested seems ok...

@alastairUK
Copy link

Hmmm, re-ran this pipeline and it's now using VS2022 17.6 but it's using 14.35 not 14.36 so looks like there's still an issue

Operating System
Microsoft Windows Server 2022
10.0.20348
Datacenter
Runner Image
Image: windows-2022
Version: 20230508.3
Included Software: https://github.com/actions/runner-images/blob/win22/20230508.3/images/win/Windows2022-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/win22%2F20230508.3
Runner Image Provisioner
2.0.171.1
Current image version: '20230508.3'

ClCompile:
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\bin\HostX86\x86\CL.exe

@marc2k3
Copy link
Author

marc2k3 commented Jun 5, 2023

You shouldn't have to but you can append -p:VCToolsVersion=14.36.32532 to your msbuild command line if you need it right now.

I tested it just now and it works on this GH actions image

  Image: windows-2022
  Version: 20230517.1
  Included Software: https://github.com/actions/runner-images/blob/win22/20230517.1/images/win/Windows2022-Readme.md
  Image Release: https://github.com/actions/runner-images/releases/tag/win22%2F20230517.1
 .github/workflows/build.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index fbee277..572bf86 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -31,7 +31,7 @@ jobs:
     - name: Build x86
       working-directory: ${{ matrix.project }}
       run: |
-        msbuild src\${{ matrix.project }}.sln -m -p:Platform=Win32 -p:Configuration=Release
+        msbuild src\${{ matrix.project }}.sln -m -p:Platform=Win32 -p:Configuration=Release -p:VCToolsVersion=14.36.32532
         copy src\Win32\Release\${{ matrix.project }}.dll ..\component
         copy src\Win32\Release\${{ matrix.project }}.pdb ..\component
         copy OptimFROG\Win32-files\OptimFROG.dll ..\component
@@ -40,7 +40,7 @@ jobs:
     - name: Build x64
       working-directory: ${{ matrix.project }}
       run: |
-        msbuild src\${{ matrix.project }}.sln -m -p:Platform=x64 -p:Configuration=Release
+        msbuild src\${{ matrix.project }}.sln -m -p:Platform=x64 -p:Configuration=Release -p:VCToolsVersion=14.36.32532
         copy src\x64\Release\${{ matrix.project }}.dll ..\component\x64
         copy src\x64\Release\${{ matrix.project }}.pdb ..\component\x64
         copy OptimFROG\x64-files\OptimFROG.dll ..\component\x64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Common Tools awaiting-deployment Code complete; awaiting deployment and/or deployment in progress bug report OS: Windows
Projects
None yet
Development

No branches or pull requests

6 participants