Open bryanwweber opened 4 years ago
Thanks @jcbrill I'll try it out on our GitHub Actions runs and see how it goes!
Thanks @jcbrill I'll try it out on our GitHub Actions runs and see how it goes!
Any updates on this and/or using 4.4.0?
I've not been able to get this to work on GH hosted runners. Unfortunately, I don't have a local Windows machine for testing.
For reference, I'm working in this PR: https://github.com/Cantera/cantera/pull/1392, I'm using SCons 4.4.0, and the software on the windows-2019
image* includes:
The specific changes I'm making are in the SConstruct
file. I tried adding
Environment(MSVC_VERSION="14.3")
but SCons couldn't find that version of MSVC (makes sense, 2019 is installed). I also tried
Environment(MSVC_VERSION="14.2", MSVC_TOOLSET_VERSION="14.3")
but SCons complained that the toolset version cannot be greater than the MSVC_VERSION
. So I think I'm misconfiguring something, because it seems like this should just work™️. I've pinged some other folks on the project who have Windows boxes to see if they can test locally.
* I'm using windows-2019
because windows-2022
only includes the 14.32 toolset
The following was done rather quickly, I apologize in advance for any erroneous information.
Unless I'm missing something, the v143 (14.3x) toolsets are not available in a 2019 installation.
The table on the windows-2019 image page seems to indicate that the v142, v141, and v140 toolsets are installed in VS2019. It looks like the 14.3X runtimes are installed as well.
This is consistent with the SCons message in the first log:
scons: warning: MSVC version '14.3' was not found.
Visual Studio C/C++ compilers may not be set correctly.
Installed versions are: ['14.2', '14.0']
Based on the installation table for the windows-2019 image and the error message above, the message appears to be consistent/correct.
VS2019 ('14.2') is detected and VS2015 ('14.0') is detected due to the v140 build tools being installed from VS2019 which is found independently via the registry.
If the above is correct, then neither MSVC_VERSION
or MSVC_TOOLSET_VERSION
can have the value '14.3'
(i.e., VS2022 is not installed and the v143 build tools are not installed).
The following should work on the windows-2019 image for VS2019;
MSVC_VERSION='14.2'
# VS2019, v142 build toolsMSVC_VERSION_TOOLSET='14.2'
# VS2019 (default), v142 build toolsMSVC_VERSION='14.2'
, MSVC_TOOLSET_VERSION='14.2'
# VS2019, v142 build tools (redundant)MSVC_VERSION='14.2'
, MSVC_TOOLSET_VERSION='14.1'
# VS2019, v141 build toolsMSVC_TOOLSET_VERSION='14.1'
# VS2019 (default), v141 build toolsBased on the table linked above, the windows-2022 image for VS2022 appears to contain the v143, v142, and v141 build tools.
The following should work on the windows-2022 image for VS2022:
MSVC_VERSION='14.3'
, MSVC_TOOLSET_VERSION='14.2'
# VS2022, v142 build toolsMSVC_TOOLSET_VERSION='14.2'
# VS2022 (default), v142 build toolsMSVC_VERSION='14.3'
, MSVC_TOOLSET_VERSION='14.1'
# VS2022, v141 build toolsMSVC_TOOLSET_VERSION='14.1'
# VS2022 (default), v141 build toolsMSVC_VERSION='14.3'
# VS2022, v143 build toolsMSVC_TOOLSET_VERSION='14.3'
# VS2022 (default), v143 build toolsMSVC_VERSION='14.3'
, MSVC_TOOLSET_VERSION='14.3'
# VS2022, v143 build tools (redundant)If possible, try MSVC_VERSION='14.3'
and MSVC_TOOLSET_VERSION='14.2'
with the windows-2022 image for the v142 build tools in VS2022.
I hope this helps.
Thanks @jcbrill I totally misread that table in the GitHub docs. I set it up the way you suggested on both their windows-2019 and windows-2022 images, and things seem to be working exactly the way I'd expect! https://github.com/Cantera/cantera/actions/runs/3094836889
This is great news for SCons and I think this issue is resolved as far as the initial report is concerned. I'll let you or @bdbaddog decide whether there's still more action items from this issue and whether those are being tracked here or elsewhere, to actually close this issue. Thanks again for the help!
May be unrelated, but my setup is still failing the MSVC_USE_SETTINGS
test (Could not find MSVC compiler 'cl'
) - all the other failures are gone with the last PR that went in. @jcbrill ?
May be unrelated, but my setup is still failing the MSVC_USE_SETTINGS test (Could not find MSVC compiler 'cl') - all the other failures are gone with the last PR that went in.
@mwichmann I will start investigating (time limited today though).
@mwichmann The MSVC_USE_SETTINGS
test passes locally with the latest SCons master both with and without the msvc cache enabled using python 3.6.
Any chance there was a msvc/toolset update and the cache is out-of-date?
of course... but weren't we somewhat immune to that now?
still fails if I move aside the old cache
of course... but weren't we somewhat immune to that now?
Yes, but it is not foolproof.
The "VCToolsInstallDir" folder is checked for existence (if the list is not empty). It may be possible that the folder exists but is empty. Unlikely, but possible.
still fails if I move aside the old cache
groan.
Could you try running just the MSVC_USE_SETTINGS test from the scons root at your convenience?
Set debug log, cache file, and run problematic test:
(_env-311-64-scons) S:\SCons\scons-master>set SCONS_MSCOMMON_DEBUG=%CD%\mydebug.txt
(_env-311-64-scons) S:\SCons\scons-master>set SCONS_CACHE_MSVC_CONFIG=%CD%\mycache.json
(_env-311-64-scons) S:\SCons\scons-master>python runtest.py .\test\msvc\MSVC_USE_SETTINGS.py
and post the debug log and cache file:
mydebug.txt
mycache.json
@mwichmann Is it possible there is a compiler executable ('cl.exe') found on the windows system path?
One of the tests in MSVC_USE_SETTINGS passes an empty dictionary and expects a warning to be issued.
As we discussed in another thread, the find_program_path(env, 'cl')
invocation (I believe erroneously) inspects the windows system path.
If 'cl.exe' is not in the generated environment but IS on the system path, the warning will not be issued and the test would fail as the expected warning text is not produced.
yeah we've been talking about the mismatch between windows path and scons path elsewhere too - I'm having trouble with the D compilers on Windows, as well as Intel Fortran, because of that.
I just tried a test by running the windows batch file from the command prompt and then running the single test:
(_env-368-64-scons) S:\SCons\scons-master>C:\\Software\\MSVS-2022-143-Com\\VC\\Auxiliary\\Build\\vcvars64.bat
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.6.4
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
(_env-368-64-scons) S:\SCons\scons-master>python runtest.py -f ..\scons-tests\msvc-tests-jcb.txt
1/1 (100.00%) S:\SCons\_env-368-64-scons\Scripts\python.exe test\MSVC\MSVC_USE_SETTINGS.py
Missing expected input from output:
Could not find MSVC compiler 'cl'
output =========================================================================
FAILED test of S:\SCons\scons-master\scripts\scons.py
at line 350 of S:\SCons\scons-master\testing\framework\TestCommon.py (must_contain_all)
from line 60 of test\MSVC\MSVC_USE_SETTINGS.py
(_env-368-64-scons) S:\SCons\scons-master>
Here are the two files... the cache I had to call .txt instead because of github's silly limitations. And yes, that looks like the same error.
I think a cl.exe was found on the system path.
The log contains the following:
00311ms:MSCommon/vc.py:msvc_setup_env#1518: use_settings {}
00357ms:MSCommon/vc.py:msvc_exists#1546: version=None, return=True
If no cl.exe is found the log should look like:
00386ms:MSCommon/vc.py:msvc_setup_env#1518: use_settings {}
00394ms:MSCommon/vc.py:msvc_setup_env#1532: did not find cl.exe
Which triggers the warning expected by the test.
In SCons\Tool\MSCommon\vc.py (starting at line 1530), try changing the search function from:
# final check to issue a warning if the compiler is not present
if not find_program_path(env, 'cl'):
debug("did not find %s", _CL_EXE_NAME)
...
to:
# final check to issue a warning if the compiler is not present
if not env.WhereIs('cl'):
debug("did not find %s", _CL_EXE_NAME)
...
The test should pass.
Prior discussion concerning cl.exe found on system path but not in environment starting here: https://github.com/SCons/scons/issues/4312#issuecomment-1605440471
I think a cl.exe was found on the system path.
yes - I just looked over at the screen and it seems I opened a "Developer Command Prompt for VS 2022" there, rather than my normal bare cmd prompt. The test passes if I do the latter.
... needless to say, that shouldn't affect the test pass/fail status... Seems like msvc tool does plenty of work now to find legitimate copies in the way we want, and we should probably stop doing what we're doing with that find_program_path call.
... needless to say, that shouldn't affect the test pass/fail status... Seems like msvc tool does plenty of work now to find legitimate copies in the way we want, and we should probably stop doing what we're doing with that find_program_path call.
I agree.
I'm not convinced that env.WhereIs('cl.exe')
is the best approach as the environment path is checked after prepending the 'restricted' msvc environment path.
It is possible the user modified the passed in environment (e.g., env['ENV']['PATH']=os.environ['PATH']
) prior to the msvc call. The desired cl.exe
could still be missing but, analogous the current problem, a spurious 'cl.exe' could be found in the env['ENV']['PATH']
.
The check should probably use only the generated dictionary PATH elements rather than the resultant env['ENV']['PATH']
.
My $0.02 cents.
Edit: add literal text for readability.
how do we solve this now?
There was a lot of discussion here, which makes for some messy reading, but the original poster did comment that things seemed to be working eventually - see https://github.com/SCons/scons/issues/3664#issuecomment-1253141077
If you're having problems finding the compiler, it would be useful to get a few more details...
There was a lot of discussion here, which makes for some messy reading, but the original poster did comment that things seemed to be working eventually - see #3664 (comment)
If you're having problems finding the compiler, it would be useful to get a few more details...
Thanks!
Some additional examples of using an older toolset are also here: https://github.com/SCons/scons/discussions/4412#discussioncomment-7034182
Describe the bug I have VS2019 installed, with the VC++ 14.2, 14.1, and 14.0 build tools selected in the installer. When
MSVC_VERSION="14.1"
is specified, SCons cannot find the 14.1 build tools. WhenMSVC_VERSION="14.2"
or14.0
are specified, SCons works as expected.Required information
scons
Further information:
MSVC_VERSION="14.2"
, SCons generates this command forvswhere.exe
:vswhere.exe -products * -version "[16.0, 17.0)" -property installationPath
and the output when run on the command line is:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise
MSVC_VERSION="14.1"
, SCons generates this command:vswhere.exe -products * -version "[15.0, 16.0)" -property installationPath
and there is no output when run on the command lineC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.16.27023
vswhere --products * -format json
is: