Repository: pytorch
Issue: Error while building pytorch from source on windows - Ninja Build Stopped, Subcommand Failed
Labels: triaged

### 🐛 Describe the bug

I am attempting to build pytorch from source on Windows without CUDA by creating a fork, cloning my forked repository to my computer, and then running the following commands in the anaconda prompt

```cd pytorch
conda activate
python setup.py develop
```

I have Visual Studio 2019 installed. This process is returning the following error

```
...
[3699/5990] Building CXX object third_party\googletest\goo...ck\CMakeFiles\gmock.dir\__\googletest\src\gtest-all.cc.obj
cl : Command line warning D9025 : overriding '/w' with '/W4'
[3700/5990] Building CXX object third_party\googletest\googletest\CMakeFiles\gtest.dir\src\gtest-all.cc.obj
cl : Command line warning D9025 : overriding '/w' with '/W4'
ninja: build stopped: subcommand failed.
```

I do not fully understand the meaning of the error ```ninja: build stopped, subcommand failed``` and would appreciate if someone could provide some guidance on what might be causing this.

Other errors in the command line output (which is a lot of lines long so I haven't attached it all) are things like

```
...\third_party\benchmark\src\benchmark.cc(192) error C3536: '<end>$L0': cannot be used before it is initialized
...\third_party\benchmark\src\benchmark.cc(192): error C3536: 'name': cannot be used before it is initialized
...\third_party\benchmark\src\benchmark.cc(192): error C2679: binary '[': no operator found which takes a right-hand operand of type 'int' (or there is no acceptable conversion)
...\third_party\benchmark\src\benchmark.cc(306): error C2923: 'std::map': 'PerFamilyRunReports' is not a valid template type argument for parameter '_Ty'
```

These errors make me believe it might be connected to the C++ compiler? 

Previously, I **have** been able to build Pytorch from source successfully and do not know what I might have changed.

Thanks!

### Versions

```
Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: Microsoft Windows 11 Home
GCC version: (i686-win32-dwarf-rev0, Built by MinGW-W64 project) 8.1.0
Clang version: Could not collect
CMake version: version 3.22.1
Libc version: N/A

Python version: 3.8.15 (default, Nov 24 2022, 14:38:14) [MSC v.1916 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-10-10.0.22000-SP0
Is CUDA available: N/A
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A

Versions of relevant libraries:
[pip3] mypy==0.812
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.23.4
[pip3] numpydoc==1.5.0
[conda] blas                      1.0                         mkl  
[conda] cpuonly                   2.0                           0    pytorch
[conda] mkl                       2021.4.0           haa95532_640  
[conda] mkl-include               2022.1.0           haa95532_193  
[conda] mkl-service               2.4.0            py38h2bbff1b_0  
[conda] mkl_fft                   1.3.1            py38h277e83a_0  
[conda] mkl_random                1.2.2            py38hf11a4ad_0
[conda] numpy                     1.23.4           py38h3b20f71_0
[conda] numpy-base                1.23.4           py38h4da318b_0
[conda] numpydoc                  1.5.0            py38haa95532_0
[conda] pytorch-mutex             1.0                         cpu    pytorch
```