MSVC 2022 17.6.x Error. Please use MSVC 17.5 - How do I select MSVC 17.5?

Hey all,

I am just trying out building blender for the first time and am running into issues that when I google for help on, there are 0 results on google.

My current setup is Windows 10 64bit (Clean install)
I have followed these instructions:

I get this error:


No explicit msvc version requested, autodetecting version.
'**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.6.4
** Copyright (c) 2022 Microsoft Corporation
'**********************************************************************
[vcvarsall.bat] Environment initialized for: ‘x64’
Compiler Detection successful, detected VS2022
Building blender with VS2022 for x64 in C:\Users\Triangle4\Desktop\Blender\blender..\build_windows_x64_vc17_Release
– Selecting Windows SDK version 10.0.20348.0 to target Windows 10.0.19045.
CMake Error at build_files/cmake/platform/platform_win32.cmake:49 (message):
Compiler is unsupported, MSVC 2022 17.6.x has codegen issues and cannot be
used to build blender. Please use MSVC 17.5 for the time being.
Call Stack (most recent call first):
CMakeLists.txt:1102 (include)

– Configuring incomplete, errors occurred!
“Configuration Failed”

if I try building after installing msvc 17.5 by using optional switches 2022b I get this error:
make 2022b
Visual Studio 2022 not found (try with the ‘verbose’ switch for more information)


if I run “make 2022b verbose” this is the output:


svn : “C:\Program Files\SlikSvn\bin\svn.exe”
cmake : “C:\Program Files\CMake\bin\cmake.exe”
ctest : “C:\Program Files\CMake\bin\ctest.exe”
git : “C:\Program Files\Git\cmd\git.exe”
python : “C:\Users\Triangle4\Desktop\Blender\blender\…\lib\win64_vc15\python\310\bin\python.exe”
Detecting msvc 2022
“C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe” -latest -products Microsoft.VisualStudio.Product.BuildTools -version [17.0,17.99) -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64
VS_Installdir=“”

Visual Studio is detected but no suitable installation was found.

Check the “Desktop development with C++” workload has been installed.

*If you are attempting to use either Visual Studio Preview version or the Visual C++ Build tools, Please see ‘make help’ on how to opt in to those toolsets. *

Visual Studio 2022 not found (try with the ‘verbose’ switch for more information)


How can I select the msvc compiler 17.5 as it tells me to in the error?

Looks like it can’t find your VS 17.5 installation or you didn’t install the C++ workload for it.

Hey lazyDodo

That’s whats wierd:


But vswhere.exe is kicking out an empty string, which doesn’t make any sense.

When i just call vswhere.exe on its own, I get this output:


Copyright (C) Microsoft Corporation. All rights reserved.

instanceId: f215bf73
installDate: 1/10/2023 3:03:17 PM
installationName: VisualStudio/17.6.4+33815.320
installationPath: C:\Program Files\Microsoft Visual Studio\2022\Community
installationVersion: 17.6.33815.320
productId: Microsoft.VisualStudio.Product.Community
productPath: C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe
state: 4294967295
isComplete: 1
isLaunchable: 1
isPrerelease: 0
isRebootRequired: 0
displayName: Visual Studio Community 2022
description: Powerful IDE, free for students, open-source contributors, and individuals
channelId: VisualStudio.17.Release
*channelUri: removed due to the new user link limit on this forum
enginePath: C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service
installedChannelId: VisualStudio.17.Release
*installedChannelUri: removed due to the new user link limit on this forum
*releaseNotes: removed due to the new user link limit on this forum
*thirdPartyNotices: removed due to the new user link limit on this forum
updateDate: 2023-06-26T07:05:33.7710849Z
catalog_buildBranch: d17.6
catalog_buildVersion: 17.6.33815.320
catalog_id: VisualStudio/17.6.4+33815.320
catalog_localBuild: build-lab
catalog_manifestName: VisualStudio
catalog_manifestType: installer
catalog_productDisplayVersion: 17.6.4
catalog_productLine: Dev17
catalog_productLineVersion: 2022
catalog_productMilestone: RTW
catalog_productMilestoneIsPreRelease: False
catalog_productName: Visual Studio
catalog_productPatchVersion: 4
catalog_productPreReleaseMilestoneSuffix: 1.0
catalog_productSemanticVersion: 17.6.4+33815.320
catalog_requiredEngineVersion: 3.6.2115.31769
properties_campaignId:
properties_channelManifestId: VisualStudio.17.Release/17.6.4+33815.320
properties_nickname:
properties_setupEngineFilePath: C:\Program Files (x86)\Microsoft Visual Studio\Installer\setup.exe

You added the older compilers to your existing VS 17.6 installation, sadly that’s not gonna won’t work as the version detected of VS will still be 17.6.

You’re gonna have to grab the 17.5 build tools installer from their release page and install that.

Thank you Lazy. I am very new to using build tools.

Yeah gotta admit, i’m not thrilled with the 17.6 black list, but they left us no choice, a blender build with 17.6 cannot be trusted near anyone’s data. It’s that bad…

I mean I am not surprised… I mean it is Microsoft, they make 10 bad things for every good thing, but what happened (am I allowed to ask that here?)

Worst kind of compiler bug, the code compiles just fine, but when you run it, it does something slightly different than what the source code told it to do, so all seems fine, but it won’t behave like it should.

if you want technical details the upstream ticket is over here:

VS 17.6 generates bad code when lambda is used as part of a C++17 Fold-Expression - Developer Community

Looks like they fixed it and are going to release it next update, which is good for future users coming to this page here to know.

1 Like

Alright, so after much install time and wading through several issues, I still cant get through the gate:

make 2022b verbose returns the following verbose error:
-------
svn : “C:\Program Files\SlikSvn\bin\svn.exe”
cmake : “C:\Program Files\CMake\bin\cmake.exe”
ctest : “C:\Program Files\CMake\bin\ctest.exe”
git : “C:\Program Files\Git\cmd\git.exe”
python : “C:\Users\Triangle4\Desktop\Blender\blender\…\lib\win64_vc15\python\310\bin\python.exe”
Detecting msvc 2022
“C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe” -latest -products Microsoft.VisualStudio.Product.BuildTools -version [17.0,17.99) -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64
VS_Installdir=“C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools”
calling “C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat” x64
*********************************************************************** *** Visual Studio 2022 Developer Command Prompt v17.5.0* *** Copyright (c) 2022 Microsoft Corporation* ***********************************************************************
[vcvarsall.bat] Environment initialized for: ‘x64’
*Testing for MSBuild *
*Visual Studio 2022 msbuild found *
Testing for the C/C++ Compiler
Visual Studio 2022 C/C++ Compiler found
Visual Studio 2022 is detected successfully
Building blender with VS2022 for x64 in C:\Users\Triangle4\Desktop\Blender\blender..\build_windows_x64_vc17_Release
Library Directory = "“C:\Users\Triangle4\Desktop\Blender\blender..\lib\win64_vc15"”
“C:\Program Files\CMake\bin\cmake.exe -G “Visual Studio 17 2022” -HC:\Users\Triangle4\Desktop\Blender\blender\ -BC:\Users\Triangle4\Desktop\Blender\blender..\build_windows_x64_vc17_Release”
Re-run cmake no build system arguments
– Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19045.
CMake Error at build_files/cmake/platform/platform_win32.cmake:49 (message):

  • Compiler is unsupported, MSVC 2022 17.6.x has codegen issues and cannot be*
  • used to build blender. Please use MSVC 17.5 for the time being.*
    Call Stack (most recent call first):
  • CMakeLists.txt:1102 (include)*

– Configuring incomplete, errors occurred!
“Configuration Failed”

I have a day off today and really wanted to give this a go but it seems like everything is broken right now.

This was after installing using the standalone build installer 17.5.33414.496.

try removing the build_windows_x64_vc17_Release folder it likely remembered the old install

That was it. Thanks lazy. We are building now!

In case this helps anyone, I had some trouble getting MSVC 17.5 to work for me - not sure if I incorrectly downgraded or needed to do something else. I was however able to install Visual Studio Preview (microsoft.com) and after using make with vs2022pre as an argument (“make 2022pre full pydebug verbose”) it successfully built Blender. Not sure if it was required, but before installing the preview version of MSVC I uninstalled Visual Studio and related build tools.

Good to hear you got it to work, maybe they fixed the preview recently?
To get the 17.5 to work, you need to have the full version of vs installed, and the 17.5 build tools with c++ desktop development checked as well.

1 Like

Hi, when I tried I got an error telling me I need to get the C++ build tools. So do I have to install 17.7.0 to make this method work?

Edit: I downloaded 17.7.0 and got building, however I am coming across a C2397 error and a C4100 warning while building, causing it to fail

If you have 17.6 or later you can refer to the @Andrew_Burke ‘s solution to configure the MSVC 2022 install. In the cmd you should configure the version by doing this

CALL "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=14.35

Apparently, Microsoft says that in august they released a version with it fixed. has anyone tried?

It probably that the error output has been written in the CMake build files. Today I use git to pull the code with the 17.6 the cmake reports the error.

Apparently, Microsoft says that in august they released a version with it fixed. has anyone tried?

yes 17.7/17.8 no longer 40% of our tests fail, we’re down to a single test now because of a different problem I’d still recommend sticking to 17.5 for now.