Building with Visual Studio Build Tools 2022

Is building Blender with ‘Visual Studio Build Tools 2022’ (including the ‘Desktop Development with C++’ workload) but without the entirety of ‘Visual Studio Community 2022’ supported?
Considering the substantial size of Visual Studio, and the fact that I’m developing in VS Code, I assumed I would only require the build tools.

I have a fresh install of Windows 11, installed the development tools as per the docs (apart from the above substitution) and am running C:\Users\chris\Documents\blender-git\blender>make update. The output of that is the following:

Warning: Python not found, there is likely an issue with the library folder
No explicit msvc version requested, autodetecting version.
Compiler Detection failed. Use verbose switch for more information. 
Visual Studio not found (try with the 'verbose' switch for more information)

Extra info:

python --version
Python 3.10.2

svn --version
svn, version 1.14.1-SlikSvn (SlikSvn/1.14.1)

cmake --version
cmake version 3.22.2

git --version
git version 2.34.1.windows.1

@LazyDodo might be something you know off the top of your head! :crossed_fingers:

while it is supported, by default it will look for the standard version of VS. you can force it to look for the build tools by adding 2022b to all your make.bat invocations

Got it, thanks for the quick reply. As I understand, any make * command becomes make 2022b * and things should work? Seems like make 2022b update is working so far.

As I understand, any make * command becomes make 2022b * and things should work?

That is correct, given you’re clearly doing cli builds switching to ninja will likely get your some build time improvements. just install ninja somewhere in the path and use make ninja 2022b full rather than make full

4 Likes

I’m getting this error, is this another thing where I just need to provide an argument somewhere?

$ ./make.bat 2022b debug
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.0.6
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
Building blender with VS2022 for x64 in C:\blender-git-2\blender\..\build_windows_x64_vc17_Debug
CMake Error: Could not create named generator Visual Studio 17 2022

Generators
* Visual Studio 16 2019        = Generates Visual Studio 2019 project files.
                                 Use -A option to specify architecture.
  Visual Studio 15 2017 [arch] = Generates Visual Studio 2017 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Visual Studio 9 2008 [arch]  = Generates Visual Studio 2008 project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Borland Makefiles            = Generates Borland makefiles.
  NMake Makefiles              = Generates NMake makefiles.
  NMake Makefiles JOM          = Generates JOM makefiles.
  MSYS Makefiles               = Generates MSYS makefiles.
  MinGW Makefiles              = Generates a make file for use with
                                 mingw32-make.
  Green Hills MULTI            = Generates Green Hills MULTI files
                                 (experimental, work-in-progress).
  Unix Makefiles               = Generates standard UNIX makefiles.
  Ninja                        = Generates build.ninja files.
  Ninja Multi-Config           = Generates build-<Config>.ninja files.
  Watcom WMake                 = Generates Watcom WMake makefiles.
  CodeBlocks - MinGW Makefiles = Generates CodeBlocks project files.
  CodeBlocks - NMake Makefiles = Generates CodeBlocks project files.
  CodeBlocks - NMake Makefiles JOM
                               = Generates CodeBlocks project files.
  CodeBlocks - Ninja           = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
  CodeLite - MinGW Makefiles   = Generates CodeLite project files.
  CodeLite - NMake Makefiles   = Generates CodeLite project files.
  CodeLite - Ninja             = Generates CodeLite project files.
  CodeLite - Unix Makefiles    = Generates CodeLite project files.
  Eclipse CDT4 - NMake Makefiles
                               = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - MinGW Makefiles
                               = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
  Kate - MinGW Makefiles       = Generates Kate project files.
  Kate - NMake Makefiles       = Generates Kate project files.
  Kate - Ninja                 = Generates Kate project files.
  Kate - Unix Makefiles        = Generates Kate project files.
  Sublime Text 2 - MinGW Makefiles
                               = Generates Sublime Text 2 project files.
  Sublime Text 2 - NMake Makefiles
                               = Generates Sublime Text 2 project files.
  Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles
                               = Generates Sublime Text 2 project files.

"Configuration Failed"

your cmake version doesn’t support vs2022, update it to a newer version and you’ll be ok

Here again, this time on a new computer. I followed the same steps as before (still have the versions of the required packages downloaded) but am hitting this error:

F:\Users\chris\Documents\blender-dev-env\blender>make ninja 2022b update
Command "2022b" unknown, aborting

I suspect it’s to do with a missing optional component of the VS 2022 build tools, I just don’t know which it would be. Do any of the ones I’ve got unchecked here seem like they would be required @LazyDodo?

Hmm even with all of these installed I still have the error. Must be something else.
image

The Command "2022b" unknown, aborting error is from our script blender-git\blender\build_files\windows\parse_arguments.cmd which is called from make.bat. Are you updated with latest master?

No, my git HEAD is quite old, I will pull using git directly and try again.

UPDATE: Seems like it’s progressing further now, thanks. Will update again if it finishes successfully but so far looks good.

That seems to have completed, now I’m having issues getting cmake gui to configure things. Not really sure what needs to be checked here. I’m guessing I’d need whatever the equivalent of gcc is on Windows, but I assumed that is the VS build tools.

Selecting Windows SDK version  to target Windows 10.0.19044.
The C compiler identification is unknown
The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:107 (project):
  No CMAKE_C_COMPILER could be found.



CMake Error at CMakeLists.txt:107 (project):
  No CMAKE_CXX_COMPILER could be found.



Configuring incomplete, errors occurred!
See also "F:/Users/chris/Documents/blender-dev-env/CMakeFiles/CMakeOutput.log".
See also "F:/Users/chris/Documents/blender-dev-env/CMakeFiles/CMakeError.log".

soooo many questions… so many…

  1. Things clearly worked in Feb, how did your branch go back in time and forget about VS 2022 by October?

  2. When you say “it completed” does that mean you ended up with a working and build you can run?

  3. When you say, “use cmake-gui to configure” are you setting up a new build ? or are you re-configuring the one from step 2? if so it shouldn’t be looking for compilers…

I’m setting up a new computer. I copied over the entire blender-dev-env folder including the source code and libs, because I remember last time I tried pulling all libs from scratch it took hours.

The thing that completed was make ninja 2022b update. That was after manually getting the source code up to date by using git directly.

I then tried running make ninja 2022b debug, which gave this output:

>make ninja 2022b debug
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.3.5
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
The system cannot find the file specified.
[vcvarsall.bat] Environment initialized for: 'x64'
Building blender with VS2022 for x64 in F:\Users\chris\Documents\blender-dev-env\blender\..\build_windows_x64_vc17_Debug
-- The C compiler identification is MSVC 19.33.31630.0
-- The CXX compiler identification is MSVC 19.33.31630.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/cl.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.23/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: F:/Users/chris/Documents/blender-dev-env/build_windows_x64_vc17_Debug/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/PROGRA~1/NINJA-~1/ninja.exe cmTC_6e875 && [1/2] Building C object CMakeFiles\cmTC_6e875.dir\testCCompiler.c.obj
    [2/2] Linking C executable cmTC_6e875.exe
    FAILED: cmTC_6e875.exe
    cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_6e875.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests  -- C:\PROGRA~2\MICROS~3\2022\BUILDT~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_6e875.dir\testCCompiler.c.obj  /out:cmTC_6e875.exe /implib:cmTC_6e875.lib /pdb:cmTC_6e875.pdb /version:0.0 /machine:x64  /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
    RC Pass 1: command "rc /fo CMakeFiles\cmTC_6e875.dir/manifest.res CMakeFiles\cmTC_6e875.dir/manifest.rc" failed (exit code 0) with the following output:
    The system cannot find the file specified
    ninja: build stopped: subcommand failed.





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:107 (project)


-- Configuring incomplete, errors occurred!
See also "F:/Users/chris/Documents/blender-dev-env/build_windows_x64_vc17_Debug/CMakeFiles/CMakeOutput.log".
See also "F:/Users/chris/Documents/blender-dev-env/build_windows_x64_vc17_Debug/CMakeFiles/CMakeError.log".

It looks like it found the compiler, so I am confused about the cmake error, but since I couldn’t really parse this error message, I wondered whether I hadn’t yet configured cmake on the new computer (and I wanted to change some options for the new computer anyway) so tried creating it. That’s when I got the output above.

Any help appreciated :pray:

Nothing really comes to mind here, quick google brought up these two issue who may be related

CMake Issue which referenced this MS issue

quick fix could be find out where rc.exe hides on your drive and chuck that folder into your path…

Thanks for the pointers. rc.exe missing from path did indeed seem to be the issue which led me to find that the Windows 10 SDK component of the build tools is required. Once I installed that, I got debug build to pass (once I ran it with administrator privileges, I don’t remember needing to do that last time).

It output a blender.exe along with all the other files. Trying to run it gave me a The Application Failed To Start Because Its Side-by-Side Configuration is Incorrect error. Time to debug what’s going on with that.

Side note: I’m not posting these errors expecting that it’s anything other than my own stupidity getting me in these issues, but more as record keeping so that I can revisit later, and maybe others who have a similar situation might find my steps helpful.

1 Like

The need to run as admin seems to be because it is building to C:\Program Files (x86)\Blender :thinking: I guess I screwed up some config somewhere. That being said, starting the executable there launches, so I think the previous error was a red herring.

checkout the prefix path in your cmakecache.txt , if it’s wrong just trash the build folder and start clean it’ll likely sort it out

1 Like

Yep I’ve got a working build now! Deleted the output folder as well as my cmake config files and re-ran, and it’s all working. Thanks for the help.