-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
build: fix detection of Visual Studio 2017 #30119
Conversation
This comment has been minimized.
This comment has been minimized.
do you know why it's not found in the |
Maybe we need to change the argument to |
Because it doesn't get there. See the debug in #30118 (comment). |
Or to be more specific in this block: Lines 239 to 272 in 11275dc
On my system:
It looks like on the CI (which uses VS2017) |
Ah, it's probably because I build Node.js inside a "Developer Command Prompt for VS 2017" command prompt which has set up that environment variable. |
I've got a build going at the moment but when it completes I'll try clearing |
@targos I've updated this PR. Turns out all we need to do is clear the value of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @richardlau!
@@ -240,6 +240,7 @@ if %target_arch%==x86 if %msvs_host_arch%==x86 set vcvarsall_arg=x86 | |||
:vs-set-2019 | |||
if defined target_env if "%target_env%" NEQ "vs2019" goto vs-set-2017 | |||
echo Looking for Visual Studio 2019 | |||
set "VCINSTALLDIR=" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set "VCINSTALLDIR=" | |
@rem VS2017 is detected here when VCINSTALLDIR is set (as in VS Command Prompt) | |
set "VCINSTALLDIR=" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be clear, this is just a suggestion. Feel free to take it, change it as you see fit or leave it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a (different) comment. PTAL.
dcdd328
to
07c4965
Compare
When run in a Visual Studio 2017 command prompt the `VCINSTALLDIR` environment variable will be already set and is not cleared by the `tools/msvs/vswhere_usability_wrapper.cmd` utility when it fails to find Visual Studio 2019. This causes `vcbuild.bat` to incorrectly assume Visual Studio 2019 and generate an incompatible configuration. Clearing the value of `VCINSTALLDIR` before calling the utility fixes the detection logic. PR-URL: nodejs#30119 Fixes: nodejs#30118 Refs: nodejs#30022 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: João Reis <[email protected]>
Landed in 1f2fdc9 |
When run in a Visual Studio 2017 command prompt the `VCINSTALLDIR` environment variable will be already set and is not cleared by the `tools/msvs/vswhere_usability_wrapper.cmd` utility when it fails to find Visual Studio 2019. This causes `vcbuild.bat` to incorrectly assume Visual Studio 2019 and generate an incompatible configuration. Clearing the value of `VCINSTALLDIR` before calling the utility fixes the detection logic. PR-URL: #30119 Fixes: #30118 Refs: #30022 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: João Reis <[email protected]>
When run in a Visual Studio 2017 command prompt the
VCINSTALLDIR
environment variable will be already set and is not cleared by the
tools/msvs/vswhere_usability_wrapper.cmd
utility when it fails tofind Visual Studio 2019. This causes
vcbuild.bat
to incorrectlyassume Visual Studio 2019 and generate an incompatible configuration.
Clearing the value of
VCINSTALLDIR
before calling the utility fixesthe detection logic.
Fixes: #30118
Refs: #30022
cc @nodejs/platform-windows @nodejs/build-files @targos
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes