# CMake error and fatal error LNK1181 building from source on Windows 10

**URL:** <https://discuss.pytorch.org/t/cmake-error-and-fatal-error-lnk1181-building-from-source-on-windows-10/47541>\
**Category:** C++\
**Created:** [June 10, 2019, 10:36am UTC](https://discuss.pytorch.org/t/cmake-error-and-fatal-error-lnk1181-building-from-source-on-windows-10/47541 "2019-06-10T10:36:41Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bega](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/b/ee7513/32.png) [@Bega](https://discuss.pytorch.org/u/Bega)\
**Post date:** [June 10, 2019, 10:36am UTC](https://discuss.pytorch.org/t/cmake-error-and-fatal-error-lnk1181-building-from-source-on-windows-10/47541/1 "2019-06-10T10:36:41Z")

</div>

I’m getting the following error while compiling PyTorch from source:

```auto
[1818/2610] Linking CXX shared library bin\caffe2.dll
FAILED: bin/caffe2.dll lib/caffe2.lib
cmd.exe /C "cd . && "C:\Program Files (x86)\CMake\bin\cmake.exe" -E vs_link_dll --intdir=caffe2\CMakeFiles\caffe2.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100177~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100177~1.0\x64\mt.exe --manifests -- C:\PROGRA~2\MIB055~1\2017\COMMUN~1\VC\Tools\MSVC\1411~1.255\bin\HostX64\x64\link.exe /nologo @CMakeFiles\caffe2.rsp /out:bin\caffe2.dll /implib:lib\caffe2.lib /pdb:bin\caffe2.pdb /dll /version:0.0 /INCREMENTAL:NO && cd ."
LINK: command "C:\PROGRA~2\MIB055~1\2017\COMMUN~1\VC\Tools\MSVC\1411~1.255\bin\HostX64\x64\link.exe /nologo @CMakeFiles\caffe2.rsp /out:bin\caffe2.dll /implib:lib\caffe2.lib /pdb:bin\caffe2.pdb /dll /version:0.0 /INCREMENTAL:NO /MANIFEST /MANIFESTFILE:bin\caffe2.dll.manifest" failed (exit code 1181) with the following output:
LINK : fatal error LNK1181: cannot open input file 'Files/pytorch/build/lib/caffe2_protos.lib'
ninja: build stopped: subcommand failed.

```

Full-log:  
[ninja\_build\_full-log](https://github.com/GibranBenitez/temporal/blob/master/ninja_build)

This happened when I followed this solution:  
[pytorch\_discussion](https://discuss.pytorch.org/t/pytorch-build-from-source-on-windows/40288)

Previously I have tried to install it from source using VS as mentioned in the README, but I encountered a CMake error:

```auto
CMake Error at caffe2_gpu_generated_THCTensor.cu.obj.Release.cmake:219

```

And now when I tried to use the same process I get the following error:

```auto
-- Build files have been written to: C:/Program Files/pytorch/build
ninja: error: unknown target '/maxcpucount:8'

```

Full-log:  
[VS\_full-log](https://github.com/GibranBenitez/temporal/blob/master/VS_cmake_full-log)

Could you please help me with this issue?

My setup:

OS: Microsoft Windows 10  
CMake version: 3.14.5  
Python 3.6.1 :: Anaconda custom (64-bit)  
nvcc: NVIDIA ® Cuda compiler driver  
Copyright © 2005-2018 NVIDIA Corporation  
Built on Sat\_Aug\_25\_21:08:04\_Central\_Daylight\_Time\_2018  
Cuda compilation tools, release 10.0, V10.0.130  
cuDNN version: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\cudnn64\_7.dl  
[My env-var PATH:](https://github.com/GibranBenitez/temporal/blob/master/Path)

---

<div class="post-metadata">

**Author:** ![Bega](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/b/ee7513/32.png) [@Bega](https://discuss.pytorch.org/u/Bega)\
**Post date:** [June 10, 2019, 10:38am UTC](https://discuss.pytorch.org/t/cmake-error-and-fatal-error-lnk1181-building-from-source-on-windows-10/47541/2 "2019-06-10T10:38:15Z")

</div>

@peterjc123 could you please help me with this?

---

<div class="post-metadata">

**Author:** ![peterjc123](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/peterjc123/32/2790_2.png) [@peterjc123](https://discuss.pytorch.org/u/peterjc123)\
**Post date:** [June 10, 2019, 11:15am UTC](https://discuss.pytorch.org/t/cmake-error-and-fatal-error-lnk1181-building-from-source-on-windows-10/47541/3 "2019-06-10T11:15:49Z")

</div>

Hey, would you please get a fresh clone and do that again? Looks like you configured with Ninja at first and turned it off later.

---

<div class="post-metadata">

**Author:** ![peterjc123](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/peterjc123/32/2790_2.png) [@peterjc123](https://discuss.pytorch.org/u/peterjc123)\
**Post date:** [June 10, 2019, 11:21am UTC](https://discuss.pytorch.org/t/cmake-error-and-fatal-error-lnk1181-building-from-source-on-windows-10/47541/4 "2019-06-10T11:21:39Z")

</div>

BTW, could you please send me the `ninja.build` file in the `build` directory?

---

<div class="post-metadata">

**Author:** ![peterjc123](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/peterjc123/32/2790_2.png) [@peterjc123](https://discuss.pytorch.org/u/peterjc123)\
**Post date:** [June 10, 2019, 11:38am UTC](https://discuss.pytorch.org/t/cmake-error-and-fatal-error-lnk1181-building-from-source-on-windows-10/47541/5 "2019-06-10T11:38:37Z")

</div>

Well, I saw that your build directory contains space. As a workground, you can just avoid that to make build pass. However, more details to fix this issue are welcomed.

---

<div class="post-metadata">

**Author:** ![Bega](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/b/ee7513/32.png) [@Bega](https://discuss.pytorch.org/u/Bega)\
**Post date:** [June 11, 2019, 10:31am UTC](https://discuss.pytorch.org/t/cmake-error-and-fatal-error-lnk1181-building-from-source-on-windows-10/47541/6 "2019-06-11T10:31:07Z")

</div>

Thank you for your quick response.  
I changed the build directory and tried again. However another error appears:

```auto
C:\pytorch\torch/csrc/jit/tracer.h(314): warning C4273: 'torch::jit::tracer::addInputs': inconsistent dll linkage [C:\p
ytorch\build\caffe2\torch\torch_python.vcxproj]
  C:\pytorch\torch/csrc/jit/tracer.h(299): note: see previous definition of 'addInputs'
C:\pytorch\torch/csrc/jit/tracer.h(321): warning C4273: 'torch::jit::tracer::addInputs': inconsistent dll linkage [C:\p
ytorch\build\caffe2\torch\torch_python.vcxproj]
  C:\pytorch\torch/csrc/jit/tracer.h(305): note: see previous definition of 'addInputs'
  serialization.cpp
C:\pytorch\torch/csrc/jit/tracer.h(314): warning C4273: 'torch::jit::tracer::addInputs': inconsistent dll linkage [C:\p
ytorch\build\caffe2\torch\torch_python.vcxproj]
  C:\pytorch\torch/csrc/jit/tracer.h(299): note: see previous definition of 'addInputs'
C:\pytorch\torch/csrc/jit/tracer.h(321): warning C4273: 'torch::jit::tracer::addInputs': inconsistent dll linkage [C:\p
ytorch\build\caffe2\torch\torch_python.vcxproj]
  C:\pytorch\torch/csrc/jit/tracer.h(305): note: see previous definition of 'addInputs'
     Creating library C:/pytorch/build/lib/Release/torch_python.lib and object C:/pytorch/build/lib/Release/torch_pytho
  n.exp
init.cpp.obj : warning LNK4049: locally defined symbol ?THPDeviceType@@3U_typeobject@@A (struct _typeobject THPDeviceTy
pe) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
python_arg_parser.obj : warning LNK4049: locally defined symbol ?THPDeviceType@@3U_typeobject@@A (struct _typeobject TH
PDeviceType) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
tensor_new.obj : warning LNK4049: locally defined symbol ?THPDeviceType@@3U_typeobject@@A (struct _typeobject THPDevice
Type) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
Event.obj : warning LNK4049: locally defined symbol ?THPDeviceType@@3U_typeobject@@A (struct _typeobject THPDeviceType)
 imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
init.cpp.obj : warning LNK4049: locally defined symbol ?THPDeviceType@@3U_typeobject@@A (struct _typeobject THPDeviceTy
pe) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
python_variable_methods.obj : warning LNK4049: locally defined symbol ?THPDeviceType@@3U_typeobject@@A (struct _typeobj
ect THPDeviceType) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
python_torch_functions.obj : warning LNK4049: locally defined symbol ?THPDeviceType@@3U_typeobject@@A (struct _typeobje
ct THPDeviceType) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
python_nn_functions.obj : warning LNK4049: locally defined symbol ?THPDeviceType@@3U_typeobject@@A (struct _typeobject
THPDeviceType) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
python_sugared_value.obj : warning LNK4217: locally defined symbol ?THPDeviceType@@3U_typeobject@@A (struct _typeobject
 THPDeviceType) imported in function "void __cdecl torch::jit::script::`dynamic initializer for 'empty_trees''(void)" (
??__Eempty_trees@script@jit@torch@@YAXXZ) [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
init.cpp.obj : warning LNK4049: locally defined symbol ?THPDtypeType@@3U_typeobject@@A (struct _typeobject THPDtypeType
) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
python_variable_methods.obj : warning LNK4049: locally defined symbol ?THPDtypeType@@3U_typeobject@@A (struct _typeobje
ct THPDtypeType) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
python_sugared_value.obj : warning LNK4049: locally defined symbol ?THPDtypeType@@3U_typeobject@@A (struct _typeobject
THPDtypeType) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
python_tensor.obj : warning LNK4049: locally defined symbol ?THPDtypeType@@3U_typeobject@@A (struct _typeobject THPDtyp
eType) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
python_arg_parser.obj : warning LNK4049: locally defined symbol ?THPDtypeType@@3U_typeobject@@A (struct _typeobject THP
DtypeType) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
init.cpp.obj : warning LNK4049: locally defined symbol ??0TypeError@torch@@QEAA@PEBDZZ (public: __cdecl torch::TypeErro
r::TypeError(char const *,...)) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
Module.cpp.obj : warning LNK4049: locally defined symbol ??0TypeError@torch@@QEAA@PEBDZZ (public: __cdecl torch::TypeEr
ror::TypeError(char const *,...)) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
tensor_apply.obj : warning LNK4049: locally defined symbol ??0TypeError@torch@@QEAA@PEBDZZ (public: __cdecl torch::Type
Error::TypeError(char const *,...)) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
tensor_new.obj : warning LNK4049: locally defined symbol ??0TypeError@torch@@QEAA@PEBDZZ (public: __cdecl torch::TypeEr
ror::TypeError(char const *,...)) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
tensor_numpy.obj : warning LNK4049: locally defined symbol ??0TypeError@torch@@QEAA@PEBDZZ (public: __cdecl torch::Type
Error::TypeError(char const *,...)) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
init.cpp.obj : warning LNK4049: locally defined symbol ??0TypeError@torch@@QEAA@PEBDZZ (public: __cdecl torch::TypeErro
r::TypeError(char const *,...)) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
python_variable.obj : warning LNK4049: locally defined symbol ??0TypeError@torch@@QEAA@PEBDZZ (public: __cdecl torch::T
ypeError::TypeError(char const *,...)) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
python_variable_indexing.obj : warning LNK4049: locally defined symbol ??0TypeError@torch@@QEAA@PEBDZZ (public: __cdecl
 torch::TypeError::TypeError(char const *,...)) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
python_tensor.obj : warning LNK4049: locally defined symbol ??0TypeError@torch@@QEAA@PEBDZZ (public: __cdecl torch::Typ
eError::TypeError(char const *,...)) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
python_arg_parser.obj : warning LNK4049: locally defined symbol ??0TypeError@torch@@QEAA@PEBDZZ (public: __cdecl torch:
:TypeError::TypeError(char const *,...)) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
DynamicTypes.obj : warning LNK4049: locally defined symbol ??0TypeError@torch@@QEAA@PEBDZZ (public: __cdecl torch::Type
Error::TypeError(char const *,...)) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
Generator.obj : warning LNK4049: locally defined symbol ??0TypeError@torch@@QEAA@PEBDZZ (public: __cdecl torch::TypeErr
or::TypeError(char const *,...)) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
python_function.obj : warning LNK4049: locally defined symbol ??0TypeError@torch@@QEAA@PEBDZZ (public: __cdecl torch::T
ypeError::TypeError(char const *,...)) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
python_legacy_variable.obj : warning LNK4049: locally defined symbol ??0TypeError@torch@@QEAA@PEBDZZ (public: __cdecl t
orch::TypeError::TypeError(char const *,...)) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
python_variable_methods.obj : warning LNK4217: locally defined symbol ??0TypeError@torch@@QEAA@PEBDZZ (public: __cdecl
torch::TypeError::TypeError(char const *,...)) imported in function "struct _object * __cdecl torch::autograd::THPVaria
ble_type(struct _object *,struct _object *,struct _object *)" (?THPVariable_type@autograd@torch@@YAPEAU_object@@PEAU3@0
0@Z) [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
python_torch_functions.obj : warning LNK4049: locally defined symbol ??0TypeError@torch@@QEAA@PEBDZZ (public: __cdecl t
orch::TypeError::TypeError(char const *,...)) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
python_nn_functions.obj : warning LNK4049: locally defined symbol ??0TypeError@torch@@QEAA@PEBDZZ (public: __cdecl torc
h::TypeError::TypeError(char const *,...)) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
Device.obj : warning LNK4049: locally defined symbol ??0TypeError@torch@@QEAA@PEBDZZ (public: __cdecl torch::TypeError:
:TypeError(char const *,...)) imported [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
init.cpp.obj : warning LNK4217: locally defined symbol ?ToONNX@jit@torch@@YA?AV?$shared_ptr@UGraph@jit@torch@@@std@@AEA
V34@W4OperatorExportTypes@onnx@2@@Z (class std::shared_ptr<struct torch::jit::Graph> __cdecl torch::jit::ToONNX(class s
td::shared_ptr<struct torch::jit::Graph> &,enum torch::onnx::OperatorExportTypes)) imported in function "void __cdecl t
orch::jit::initJITBindings(struct _object *)" (?initJITBindings@jit@torch@@YAXPEAU_object@@@Z) [C:\pytorch\build\caffe2
\torch\torch_python.vcxproj]
init.cpp.obj : warning LNK4217: locally defined symbol ?BlockToONNX@jit@torch@@YAXPEAUBlock@12@0W4OperatorExportTypes@o
nnx@2@V?$unordered_map@PEAUValue@jit@torch@@PEAU123@U?$hash@PEAUValue@jit@torch@@@std@@U?$equal_to@PEAUValue@jit@torch@
@@5@V?$allocator@U?$pair@QEAUValue@jit@torch@@PEAU123@@std@@@5@@std@@@Z (void __cdecl torch::jit::BlockToONNX(struct to
rch::jit::Block *,struct torch::jit::Block *,enum torch::onnx::OperatorExportTypes,class std::unordered_map<struct torc
h::jit::Value *,struct torch::jit::Value *,struct std::hash<struct torch::jit::Value *>,struct std::equal_to<struct tor
ch::jit::Value *>,class std::allocator<struct std::pair<struct torch::jit::Value * const,struct torch::jit::Value *> >
>)) imported in function "void __cdecl torch::jit::initJITBindings(struct _object *)" (?initJITBindings@jit@torch@@YAXP
EAU_object@@@Z) [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
init.cpp.obj : warning LNK4217: locally defined symbol ?PrepareDivisionForONNX@jit@torch@@YAXAEBV?$shared_ptr@UGraph@ji
t@torch@@@std@@@Z (void __cdecl torch::jit::PrepareDivisionForONNX(class std::shared_ptr<struct torch::jit::Graph> cons
t &)) imported in function "void __cdecl torch::jit::initJITBindings(struct _object *)" (?initJITBindings@jit@torch@@YA
XPEAU_object@@@Z) [C:\pytorch\build\caffe2\torch\torch_python.vcxproj]
init.cpp.obj : warning LNK4217: locally defined symbol ?getRecursiveScriptMode@script@jit@torch@@YAAEA_NXZ (bool & __cd
ecl torch::jit::script::getRecursiveScriptMode(void)) imported in function "private: static class pybind11::handle __cd
ecl <lambda_699ff1579e5ea22a9941363e0bb1e852>::<lambda_invoker_cdecl>(struct pybind11::detail::function_call &)" (?<lam
bda_invoker_cdecl>@<lambda_699ff1579e5ea22a9941363e0bb1e852>@@CA?AVhandle@pybind11@@AEAUfunction_call@detail@3@@Z) [C:\
pytorch\build\caffe2\torch\torch_python.vcxproj]
  torch_python.vcxproj -> C:\pytorch\build\bin\Release\torch_python.dll
Traceback (most recent call last):
  File "setup.py", line 752, in <module>
    build_deps()
  File "setup.py", line 320, in build_deps
    build_dir='build')
  File "C:\pytorch\tools\build_pytorch_libs.py", line 88, in build_caffe2
    check_call(build_cmd, cwd=build_dir, env=my_env)
  File "C:\Users\gjben\Anaconda3\lib\subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '/maxcpucount:8']' returned non-zero exit status 1.

```

It happens when running:

```auto
python setup.py build --cmake

```

---

<div class="post-metadata">

**Author:** ![peterjc123](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/peterjc123/32/2790_2.png) [@peterjc123](https://discuss.pytorch.org/u/peterjc123)\
**Post date:** [June 11, 2019, 10:45am UTC](https://discuss.pytorch.org/t/cmake-error-and-fatal-error-lnk1181-building-from-source-on-windows-10/47541/7 "2019-06-11T10:45:07Z")

</div>

I couldn’t find any error in your post.

---

<div class="post-metadata">

**Author:** ![Bega](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/b/ee7513/32.png) [@Bega](https://discuss.pytorch.org/u/Bega)\
**Post date:** [June 11, 2019, 10:52am UTC](https://discuss.pytorch.org/t/cmake-error-and-fatal-error-lnk1181-building-from-source-on-windows-10/47541/8 "2019-06-11T10:52:56Z")

</div>

Here you have it:

```auto
Traceback (most recent call last):
  File "setup.py", line 752, in <module>
    build_deps()
  File "setup.py", line 320, in build_deps
    build_dir='build')
  File "C:\pytorch\tools\build_pytorch_libs.py", line 88, in build_caffe2
    check_call(build_cmd, cwd=build_dir, env=my_env)
  File "C:\Users\gjben\Anaconda3\lib\subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '/maxcpucount:8']' returned non-zero exit status 1.

```

And here you have the lines I could record from the full-log:  
[partial-log](https://github.com/GibranBenitez/temporal/blob/master/second_VS)

---

<div class="post-metadata">

**Author:** ![Bega](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/b/ee7513/32.png) [@Bega](https://discuss.pytorch.org/u/Bega)\
**Post date:** [June 11, 2019, 11:00am UTC](https://discuss.pytorch.org/t/cmake-error-and-fatal-error-lnk1181-building-from-source-on-windows-10/47541/9 "2019-06-11T11:00:10Z")

</div>

Btw, this time I used:

```auto
set CMAKE_GENERATOR=Visual Studio 15 2017

```

Therefore I couln’t find any file

> [@peterjc123](#):
>
> ninja.build

---

<div class="post-metadata">

**Author:** ![peterjc123](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/peterjc123/32/2790_2.png) [@peterjc123](https://discuss.pytorch.org/u/peterjc123)\
**Post date:** [June 11, 2019, 11:09am UTC](https://discuss.pytorch.org/t/cmake-error-and-fatal-error-lnk1181-building-from-source-on-windows-10/47541/10 "2019-06-11T11:09:42Z")

</div>

Would you please use Ninja as the generator? I didn’t find any relevant clues in your log that may cause the build failure. Actually, I’m also facing some really weird issues when using MSBuild and CMake 3.14.

---

<div class="post-metadata">

**Author:** ![Bega](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/b/ee7513/32.png) [@Bega](https://discuss.pytorch.org/u/Bega)\
**Post date:** [June 11, 2019, 11:33am UTC](https://discuss.pytorch.org/t/cmake-error-and-fatal-error-lnk1181-building-from-source-on-windows-10/47541/11 "2019-06-11T11:33:55Z")

</div>

Sure, I will let you know the results as soon as I success or get something weird.

Once more, thank you for your help.

---

<div class="post-metadata">

**Author:** ![Bega](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/b/ee7513/32.png) [@Bega](https://discuss.pytorch.org/u/Bega)\
**Post date:** [June 12, 2019, 3:12am UTC](https://discuss.pytorch.org/t/cmake-error-and-fatal-error-lnk1181-building-from-source-on-windows-10/47541/12 "2019-06-12T03:12:42Z")

</div>

Thank you very much for your help.  
It worked. In resume:

- I changed the build directory to ‘C:\pytorch’ (no spaces in it)
- I used ninja as the generator following:  
[Install with ninja](https://discuss.pytorch.org/t/pytorch-build-from-source-on-windows/40288/17)

Just as reference this is my env info:

```auto
PyTorch version: 1.2.0a0+f2623c7
Is debug build: No
CUDA used to build PyTorch: 10.0

OS: Microsoft Windows 10 Home
GCC version: (tdm64-1) 5.1.0
CMake version: version 3.14.5

Python version: 3.6
Is CUDA available: Yes
CUDA runtime version: 10.0.130
GPU models and configuration: GPU 0: GeForce GTX 1070
Nvidia driver version: 425.25
cuDNN version: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\cudnn64_7.dll

Versions of relevant libraries:
[pip] numpy==1.12.1
[pip] numpydoc==0.6.0
[pip] torch==1.2.0a0+f2623c7
[conda] mkl 2019.0 <pip>
[conda] mkl 2017.0.1 0
[conda] mkl-include 2019.0 <pip>
[conda] mkl-service 1.1.2 py36_3
[conda] torch 1.2.0a0+f2623c7 <pip>

```
