[CMake] 'cmake.exe -G Ninja' doesn't work for VS2017 with cmake ver 3.9.1

Masaru Tsuchiyama m.tmatma at gmail.com
Mon Aug 21 09:39:21 EDT 2017


Hello

I did git bisect.

The problematic commit is 
https://gitlab.kitware.com/cmake/cmake/commit/690acadc17263621f5361d48057c6f938e698a58

cmake with Ninja Generator succeeds by reverting 
690acadc17263621f5361d48057c6f938e698a58

 > git checkout master
 > git checkout -b try-revert-690acadc17263621f5361d48057c6f938e698a58
 > git revert 690acadc17263621f5361d48057c6f938e698a58

 > git bisect log
git bisect start
# bad: [a1b84ac2a6eec367a8a56f4a0f811e78f5d60fab] CMake Nightly Date Stamp
git bisect bad a1b84ac2a6eec367a8a56f4a0f811e78f5d60fab
# good: [db3499df5d06ab2cacc61e9f7720a33456aeafe4] CMake 3.7.1
git bisect good db3499df5d06ab2cacc61e9f7720a33456aeafe4
# good: [f36eaf6a6eb8a7ef1127ad43e419896be89f0e39] Refactor 
WINDOWS_EXPORT_ALL_SYMBOLS implementation
git bisect good f36eaf6a6eb8a7ef1127ad43e419896be89f0e39
# good: [80e0ef4082d999e629688e9a6639ac498634b5ed] Merge topic 
'GNU-FindBinUtils-patterns'
git bisect good 80e0ef4082d999e629688e9a6639ac498634b5ed
# bad: [43c3afa74538fd7b78bcf534bfb3fa93c3c1f191] Merge topic 
'fix-crash-on-non-enabled-language-features'
git bisect bad 43c3afa74538fd7b78bcf534bfb3fa93c3c1f191
# bad: [2d3d88f3bb7076a26d9147f63453931595133aa1] Merge topic 
'GoogleTest-disabled-tests'
git bisect bad 2d3d88f3bb7076a26d9147f63453931595133aa1
# good: [256481499d56589e98659bd069d7f8a2fd653546] Merge topic 
'update-kwsys'
git bisect good 256481499d56589e98659bd069d7f8a2fd653546
# bad: [47281310bf610f3ab975d00831e9f3fe713ddde1] Merge topic 
'minor-cleanups'
git bisect bad 47281310bf610f3ab975d00831e9f3fe713ddde1
# bad: [f8642f953d3d8547bd31fcb35a4737fa91d9126f] Merge topic 
'reduce-string-copying'
git bisect bad f8642f953d3d8547bd31fcb35a4737fa91d9126f
# bad: [bc341a9d5e3863dd80393144eae88f27883db764] Merge topic 'update-libuv'
git bisect bad bc341a9d5e3863dd80393144eae88f27883db764
# good: [6f74bbaffec687dce755ee985b3bf69e915d3a8d] Merge topic 
'findxmlrpc_fix'
git bisect good 6f74bbaffec687dce755ee985b3bf69e915d3a8d
# bad: [1ebb421bfc8eb21a4e5e56e501a62d000a9f59db] Merge branch 
'upstream-libuv' into update-libuv
git bisect bad 1ebb421bfc8eb21a4e5e56e501a62d000a9f59db
# bad: [bc407ba6ba28293b5fc0025fa08e8fe71365eab8] Merge topic 
'codecvt-revise'
git bisect bad bc407ba6ba28293b5fc0025fa08e8fe71365eab8
# bad: [690acadc17263621f5361d48057c6f938e698a58] codecvt: Re-implement 
do_out and do_unshift
git bisect bad 690acadc17263621f5361d48057c6f938e698a58
# first bad commit: [690acadc17263621f5361d48057c6f938e698a58] codecvt: 
Re-implement do_out and do_unshift

This is the batch file which was used for 'git bisect'.
I used https://github.com/m-tmatma/cmake-sample.git as the input of cmake.
--------------------------------------------------------------------------
@echo on

cd /d %~dp0

set CONFIGURATION=Debug
set SRC_CMAKE=%~dp0
set SRC_HELLO=%~dp0..\cmake-sample\HelloWorld
set OUTDIR_CMAKE=%~dp0build-cmake
set OUTDIR_HELLO=%~dp0build-hello
set BUILT_CMAKE=%OUTDIR_CMAKE%\bin\%CONFIGURATION%\cmake.exe
set DEVENV="C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Community\Common7\IDE\devenv.com"

if not exist %OUTDIR_CMAKE% mkdir %OUTDIR_CMAKE%
cd /d %OUTDIR_CMAKE%

cmake -G "Visual Studio 15 2017" -D CMAKE_INSTALL_PREFIX=c:\cmake 
%SRC_CMAKE%
%DEVENV% CMake.sln /build "%CONFIGURATION%|Win32" /project cmake

cd /d %~dp0

if not exist %OUTDIR_HELLO% mkdir %SRC_HELLO%

cd /d %OUTDIR_HELLO%
%BUILT_CMAKE% -G Ninja %SRC_HELLO% || ( echo error && cd /d %~dp0 && 
exit /b 1)

cd /d %~dp0
exit /b 0
--------------------------------------------------------------------------


Masaru Tsuchiyama wrote:
> Hello
> 
> I found a bug that cmake doesn't create 'rules.ninja' while the build 
> process even though generated build.ninja has a line "include rules.ninja".
> 
> 
> Then running with -G Ninja fails with VS2017.
> 
> cmake ver 3.7.1 doesn't happen
> .
> cmake ver 3.9.1 happens.
> cmake bb3647060cd8ddc4184687b64469d6a8554f49b3 happens.
> 
> 
> 
> I found this for llvm first, but it happens with the other projects.
> 
> example: HelloWorld in https://github.com/m-tmatma/cmake-sample.git
> 
> HelloWorld is a very simple cmake project.
> 
> This commands can reproduce this.
> ----------------------------------------------------------------
> git clone https://github.com/m-tmatma/cmake-sample.git
> mkdir cmake-sample\HelloWorld\Build
> cd    cmake-sample\HelloWorld\Build
> call "C:\Program Files (x86)\Microsoft Visual 
> Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86
> cmake.exe -G Ninja ..
> ----------------------------------------------------------------
> 
> This is the output of cmake bb3647060cd8ddc4184687b64469d6a8554f49b3.
> -------------------------------------------------------------------
> -- The C compiler identification is MSVC 19.11.25506.0
> -- The CXX compiler identification is MSVC 19.11.25506.0
> -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual 
> Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe
> -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual 
> Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe 
> -- broken
> CMake Error at 
> C:/gitwork/GitHub/cmake/cmake-tmatma/Modules/CMakeTestCCompiler.cmake:51 
> (message):
>    The C compiler "C:/Program Files (x86)/Microsoft Visual
> 
> Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe" is
>    not able to compile a simple test program.
> 
>    It fails with the following output:
> 
>     Change Dir: 
> C:/gitwork/test/test/cmake-sample/HelloWorld/Build/CMakeFiles/CMakeTmp
> 
> 
> 
>    Run Build Command:"C:/PROGRA~2/Ninja/ninja.exe" "cmTC_80f4d"
> 
>    ninja: error: build.ninja:30: loading 'rules.ninja':
>    指定されたファイルが見つかりません。
> 
> 
> 
>    include rules.ninja
> 
>                       ^ near here
> 
> 
> 
> 
> 
>    CMake will not be able to correctly generate this project.
> Call Stack (most recent call first):
>    CMakeLists.txt:10 (project)
> 
> 
> -- Configuring incomplete, errors occurred!
> See also 
> "C:/gitwork/test/test/cmake-sample/HelloWorld/Build/CMakeFiles/CMakeOutput.log". 
> 
> See also 
> "C:/gitwork/test/test/cmake-sample/HelloWorld/Build/CMakeFiles/CMakeError.log". 
> 
> -------------------------------------------------------------------
> 
> This is the output of cmake 3.7.1 for the same project.
> -------------------------------------------------------------------
> -- The C compiler identification is MSVC 19.11.25506.0
> -- The CXX compiler identification is MSVC 19.11.25506.0
> -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual 
> Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe
> -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual 
> Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe 
> -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft 
> Visual 
> Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe
> -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft 
> Visual 
> Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe 
> -- works
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Detecting CXX compile features
> -- Detecting CXX compile features - done
> -- Configuring done
> -- Generating done
> -- Build files have been written to: 
> C:/gitwork/test/test/cmake-sample/HelloWorld/Build
> -------------------------------------------------------------------
> 
> 


-- 
Masaru Tsuchiyama <m.tmatma at gmail.com>


More information about the CMake mailing list