Microsoft toolset 14.40 does not work with SCons 4.7 and earlier
This was an anticipated issue (see Discussion #4484) but now it has landed (late May 2024) and indeed things break.
Visual Studio 17.10 has released now, and with it a toolset numbered 14.40. As noted in the linked discussion, previously a version like 14.40 would have indicated the v144 build tools, but this is not the case, we're still on v143. Microsoft knows this could cause some breakage and there's a blog post about it in the discussion, but here we are: things are broken.
These tests failed in a full run:
Failed the following 7 tests:
SCons\Tool\MSCommon\MSVC\ScriptArgumentsTests.py
SCons\Tool\MSCommon\vcTests.py
test\MSVC\msvc_cache_force_defaults.py
test\MSVC\MSVC_SDK_VERSION.py
test\MSVC\MSVC_SPECTRE_LIBS.py
test\MSVC\MSVC_TOOLSET_VERSION.py
test\MSVC\MSVC_UWP_APP.py
Errors seen include the very expected:
Traceback (most recent call last):
File "C:\Users\mats\Documents\github\scons\SCons\Tool\MSCommon\MSVC\ScriptArgumentsTests.py", line 573, in test_msvc_script_args_none
self.run_msvc_script_args_none()
File "C:\Users\mats\Documents\github\scons\SCons\Tool\MSCommon\MSVC\ScriptArgumentsTests.py", line 292, in run_msvc_script_args_none
_ = func(env, version_def.msvc_version, vc_dir, '')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mats\Documents\github\scons\SCons\Tool\MSCommon\MSVC\ScriptArguments.py", line 929, in msvc_script_arguments
toolset = _toolset_version(toolset_version)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mats\Documents\github\scons\SCons\Tool\MSCommon\MSVC\ScriptArguments.py", line 190, in _toolset_version
vs_def = Config.MSVC_VERSION_INTERNAL[verstr]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: '14.4'
as well as
Traceback (most recent call last):
File "C:\Users\mats\Documents\github\scons\SCons\Tool\MSCommon\MSVC\ScriptArgumentsTests.py", line 578, in test_msvc_script_args
self.run_msvc_script_args()
File "C:\Users\mats\Documents\github\scons\SCons\Tool\MSCommon\MSVC\ScriptArgumentsTests.py", line 310, in run_msvc_script_args
earlier_toolset_versions = [toolset_def for toolset_def in toolset_versions if toolset_def.msvc_vernum != version_def.msvc_vernum]
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'msvc_vernum'
Toolset 14.40 definitely does not work with the SCons 4.7 test suite. However, simple builds might work without error.
A simple build withMSVC_VERSION="14.3" and the master branch appears to use toolset 14.40 without error:
Build: _build001 {'MSVC_VERSION': '14.3', 'MSVC_NOTFOUND_POLICY': 'Error'}
cl.exe: C:\Software\MSVS-2022-143-Com\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64\cl.exe
Construction variable validation is more likely to fail.
Merged PR #4534 addresses this issue.
I believe this issue can be closed.