Skip to content
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

Ninja fails to return error code and stop on error when used with MSVC and CMake #1446

Closed
peterjc123 opened this issue Jun 10, 2018 · 1 comment

Comments

@peterjc123
Copy link

peterjc123 commented Jun 10, 2018

Ninja version: 1.8,2
CMake version: 3.8.1
MSVC version: 19.11.25547
OS: Windows 10, Windows Server 2012 R2

Problem description:
When it meets an error, it doesn't stop. And what's worse, the error code is zero. In that case, we will consider it a successful build.

Steps to reproduce:
The simplified version of the setup steps on PyTorch repo :

git clone --recursive https://github.com/pytorch/pytorch
cd pytorch/tools

set "VS150COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build"
set CMAKE_GENERATOR=Ninja
set NO_CUDA=1

call "%VS150COMNTOOLS%\vcvarsall.bat" x64

build_pytorch_libs.bat caffe2

And the log will be like this and at the end of script execution the return code ERRORLEVEL will be zero:

20:54:41 [430/444] Linking CXX shared library bin\caffe2.dll
20:54:41    Creating library lib\caffe2.lib and object lib\caffe2.exp
20:54:42 [431/444] Linking CXX executable bin\apply_utils_test.exe
20:54:42 FAILED: bin/apply_utils_test.exe 
20:54:42 cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=caffe2\CMakeFiles\apply_utils_test.dir --manifests  -- C:\PROGRA~2\MIB055~1\2017\COMMUN~1\VC\Tools\MSVC\1411~1.255\bin\Hostx86\x64\link.exe /nologo caffe2\CMakeFiles\apply_utils_test.dir\__\aten\src\ATen\test\apply_utils_test.cpp.obj  /out:bin\apply_utils_test.exe /implib:lib\apply_utils_test.lib /pdb:bin\apply_utils_test.pdb /version:0.0  /machine:x64 /LIBPATH:C:/Jenkins/workspace/pytorch-builds/pytorch-win-ws2016-cuda9-cudnn7-py3-build/torch/lib/tmp_install/lib /INCREMENTAL:NO  /subsystem:console  lib\caffe2.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
20:54:42 LINK: command "C:\PROGRA~2\MIB055~1\2017\COMMUN~1\VC\Tools\MSVC\1411~1.255\bin\Hostx86\x64\link.exe /nologo caffe2\CMakeFiles\apply_utils_test.dir\__\aten\src\ATen\test\apply_utils_test.cpp.obj /out:bin\apply_utils_test.exe /implib:lib\apply_utils_test.lib /pdb:bin\apply_utils_test.pdb /version:0.0 /machine:x64 /LIBPATH:C:/Jenkins/workspace/pytorch-builds/pytorch-win-ws2016-cuda9-cudnn7-py3-build/torch/lib/tmp_install/lib /INCREMENTAL:NO /subsystem:console lib\caffe2.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:bin\apply_utils_test.exe.manifest" failed (exit code 1104) with the following output:
20:54:42 LINK : fatal error LNK1104: cannot open file 'tbb.lib'
20:54:42 [432/444] Linking CXX executable bin\broadcast_test.exe
20:54:42 [433/444] Linking CXX executable bin\atest.exe
20:54:42 [434/444] Linking CXX executable bin\wrapdim_test.exe
20:54:42 [435/444] Linking CXX executable bin\dlconvertor_test.exe
20:54:42 [436/444] Linking CXX executable bin\scalar_test.exe
20:54:42 [437/444] Linking CXX executable bin\undefined_tensor_test.exe
20:54:42 [438/444] Linking CXX executable bin\basic.exe
20:54:42 ninja: build stopped: subcommand failed.
@nico
Copy link
Collaborator

nico commented Nov 15, 2018

I'm guessing this might be #1469 / https://gitlab.kitware.com/cmake/cmake/issues/18524 (a cmake bug).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants