KEMBAR78
Block building for the wrong target arch in Developer Command Prompt by cpplearner · Pull Request #5731 · microsoft/STL · GitHub
Skip to content

Conversation

@cpplearner
Copy link
Contributor

#4709 and #4717 make it impossible to build in the wrong command prompt (e.g. if someone builds the STL in an "x64 Native Tools Command Prompt" and runs the tests in an "x86 Native Tools Command Prompt"). But they are ineffective in a "Developer Command Prompt" because they examine the Platform env var, which is not defined there.

This PR examines VSCMD_ARG_TGT_ARCH instead, which is defined in both the Developer Command Prompt and the Native Tools Command Prompt.

It's unclear to me whether it is safe to use such an undocumented env var. But anyway, if someone encounters an unexpected error, they can just manually unset VSCMD_ARG_TGT_ARCH when building.

@cpplearner cpplearner requested a review from a team as a code owner September 19, 2025 03:24
@github-project-automation github-project-automation bot moved this to Initial Review in STL Code Reviews Sep 19, 2025
@cpplearner cpplearner changed the title The Platform env var is not set in Developer Command Prompt; examine VSCMD_ARG_TGT_ARCH instead Block building for the wrong target arch in Developer Command Prompt Sep 19, 2025
@StephanTLavavej StephanTLavavej moved this from Initial Review to Ready To Merge in STL Code Reviews Sep 19, 2025
@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Sep 19, 2025
@StephanTLavavej StephanTLavavej moved this from Ready To Merge to Merging in STL Code Reviews Sep 19, 2025
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej added the build Related to the build system label Sep 22, 2025
@StephanTLavavej StephanTLavavej merged commit 49f0d9d into microsoft:main Sep 22, 2025
39 checks passed
@StephanTLavavej
Copy link
Member

Thanks for noticing that Diablo Canyon 1 wasn't like Diablo Canyon 2! ☢️ 🦅 👁️

@cpplearner cpplearner deleted the platform-not-defined branch September 23, 2025 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Related to the build system enhancement Something can be improved

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants