View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012410CMakeCMakepublic2011-08-18 04:272016-06-10 14:31
ReporterRoland Richter 
Assigned ToBill Hoffman 
PrioritynormalSeveritymajorReproducibilityrandom
StatusclosedResolutionmoved 
PlatformOSOS VersionWin7 (64bit)
Product VersionCMake 2.8.5 
Target VersionFixed in Version 
Summary0012410: CMake randomly fails to detect Visual Studio 2010 C/CXX compiler since CMake 2.8.5. rc3
DescriptionWhen building a tutorial C++ example (attached) on my computer using CMake 2.8.5 and Visual Studio 2010 Express Edition, I experience one of the following behaviours:

1. Everything works as expected, i.e. CMake's output is

D:\temp\CMakeTutorial\build-win32-vc10>cmake -G "Visual Studio 10" ..
-- Check for working C compiler using: Visual Studio 10
-- Check for working C compiler using: Visual Studio 10 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 10
-- Check for working CXX compiler using: Visual Studio 10 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: D:/temp/CMakeTutorial/build-win32-vc10

2. CMake fails to detect the C compiler, i.e. its output is

D:\temp\CMakeTutorial\build-win32-vc10>cmake -G "Visual Studio 10" ..
-- Check for working C compiler using: Visual Studio 10
-- Check for working C compiler using: Visual Studio 10 -- broken
-- Configuring incomplete, errors occurred!

3. CMake detects the C compiler, but fails to detect the CXX compiler, i.e.

D:\temp\CMakeTutorial\build-win32-vc10>cmake -G "Visual Studio 10" ..
-- Check for working C compiler using: Visual Studio 10
-- Check for working C compiler using: Visual Studio 10 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 10
-- Check for working CXX compiler using: Visual Studio 10 -- broken
-- Configuring incomplete, errors occurred!

4. CMake both detects the C and CXX compiler, but fails to detect ABI infos:

D:\temp\CMakeTutorial\build-win32-vc10>cmake -G "Visual Studio 10" ..
-- Check for working C compiler using: Visual Studio 10
-- Check for working C compiler using: Visual Studio 10 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working CXX compiler using: Visual Studio 10
-- Check for working CXX compiler using: Visual Studio 10 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Configuring done
-- Generating done
-- Build files have been written to: D:/temp/CMakeTutorial/build-win32-vc10


In cases 2 and 3 (i.e. if either C or CXX compiler was not detected), a plethora of of Visual Studio 2010 output is dumped to stderr, starting with

-- Check for working CXX compiler using: Visual Studio 10 -- broken
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake:45 (MESSAGE):
  The C++ compiler "cl" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: D:/temp/CMakeTutorial/build-win32-vc10/CMakeFiles/CMakeTmp



  Run Build Command:C:\PROGRA~2\MICROS~1.0\Common7\IDE\VCExpress.exe
  CMAKE_TRY_COMPILE.sln /build Debug /project cmTryCompileExec



  Microsoft (R) Visual C++ 2010 Express Version 10.0.30319.1.

  Copyright (C) Microsoft Corp. All rights reserved.

  1>------ Build started: Project: cmTryCompileExec, Configuration: Debug
  Win32 ------

  1>Build started Do 18.Aug.11 09:18:28.
Additional InformationUsing the attached script, I tested this behaviour both with CMake 2.8.5 rc2 and rc3. Whereas rc2 always works as expected, rc3 shows one of the aforementioned behaviours in a random pattern.

So, obviously, this behaviour was introduced between CMake 2.8.5 rc2 and rc3; perhaps, due to the modifications mentioned in http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/37124/focus=37138 [^]
TagsNo tags attached.
Attached Fileszip file icon CMakeTutorial.zip [^] (1,346 bytes) 2011-08-18 04:27
txt file icon patch_vcexpress.txt [^] (2,272 bytes) 2011-08-18 10:32 [Show Content]

 Relationships
related to 0012957closedBrad King Compiler tests randomly fail on Win7 

  Notes
(0027229)
Bill Hoffman (manager)
2011-08-18 04:53

I don't think VCExpress can run fortran. So, I guess the fix for this is to never use VCExpress, but either use devenv or MSBuild. I don't think this issue happens with devenv as the build tool
(0027230)
Roland Richter (reporter)
2011-08-18 07:38

I don't run Fortran. I use the tutorial C++ example from "Mastering CMake", i.e. from http://www.cmake.org/cmake/help/cmake_tutorial.html. [^]

What do you exactly mean by "... use devenv or MSBuild"?
Is the call

cmake -G "Visual Studio 10" ..

incorrect or incomplete? Do I have to set an environment variable or something?
(0027231)
Bill Hoffman (manager)
2011-08-18 08:34

The change that was made was that CMake started using VCExpress as the build tool for visual studio 10. In rc2 it used MSBuild to drive builds. The change was made because with Intel Fortran you can not use MSBuild. So, if you run CMake setting these two variables to the path to MSBuild: CMAKE_MAKE_PROGRAM CMAKE_BUILD_TOOL, either with -D or adding them to the cache using cmake-gui before you run generate, then it should work. You can look at the CMakeCache.txt for rc2 vs rc3 to see the difference in build tools used, and to get the correct values for your machine.
(0027232)
Roland Richter (reporter)
2011-08-18 09:45

Thanks for the help. Indeed, calling

cmake -DCMAKE_MAKE_PROGRAM=C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe -G "Visual Studio 10" ..

solves the problem, whereas

cmake -DCMAKE_MAKE_PROGRAM="C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/VCExpress.exe" -G "Visual Studio 10" ..

exhibits the same erroneous behaviour.

So, since VCExpress is not suitable as a CMAKE_MAKE_PROGRAM, devenv is not part of Express (and Express cannot run Fortran, anyway), I guess that in case of Express the only sensible choice for CMAKE_MAKE_PROGRAM is MSBuild, as it was before rc3?
(0027233)
Bill Hoffman (manager)
2011-08-18 10:09

OK, thanks for the validation that this fixes your problem. I will try to figure out how to make it pick devenv when it is there, and MSBuild when it is not. The trick is not to pick MSBuild when there is a devenv.
(0027234)
Bill Hoffman (manager)
2011-08-18 10:34

Can you try the attached Patch? You should be able to patch an installed CMake. The change only modifies Modules/CMakeVS10FindMake.cmake. If you can verify that this works, that would be helpful. Thanks.
(0027239)
Bill Hoffman (manager)
2011-08-18 12:32

I merged that into cmake next. I tested on our machine with vcexpress. It worked there and picked MSBuild as the build tool. Although on our machine vcexpress also worked as a build tool.


ssh git@cmake.org stage cmake merge -b next fix_vcexpress_2010
Fetching upstream next
Merge topic 'fix_vcexpress_2010' into next

3ca1df8 Use MSBuild when devenv is not around, since VCExpress seems broken.
d7184e0 KWSys Nightly Date Stamp

Pushing upstream next
To git@cmake.org:cmake.git
(0027244)
Roland Richter (reporter)
2011-08-19 02:36

Positive. The patch indeed does solve the problem. Thanks for the quick reaction.
(0028552)
kstrike155 (reporter)
2012-02-10 16:07

I'm having the same issue. Sometimes my build will randomly and magically work, but most of the time I'm getting an error. I have the fix, and it seems to be using the correct executables to build. Here's my log, any thoughts?

    [cmake] Source Directory: C:\Users\myname\Workspace\myproject\Services\myprojectCommon
    [cmake] Binary Directory: C:\Users\myname\Workspace\myproject\Services\myprojectCommon\build
    [cmake] Generator: windows: Visual Studio 10 Win64
    [cmake] -- Check for working C compiler using: Visual Studio 10 Win64
    [cmake] -- Check for working C compiler using: Visual Studio 10 Win64 -- works
    [cmake] -- Detecting C compiler ABI info
    [cmake] -- Detecting C compiler ABI info - failed
    [cmake] -- Check for working CXX compiler using: Visual Studio 10 Win64
    [cmake] CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake:45 (MESSAGE):
    [cmake] The C++ compiler "cl" is not able to compile a simple test program.
    [cmake] It fails with the following output:
    [cmake] Change Dir: C:/Users/myname/Workspace/myproject/Services/myprojectCommon/build/CMakeFiles/CMakeTmp
    [cmake] -- Check for working CXX compiler using: Visual Studio 10 Win64 -- broken
    [cmake]
    [cmake] Run Build Command:C:\PROGRA~2\MICROS~2.0\Common7\IDE\devenv.com
    [cmake] CMAKE_TRY_COMPILE.sln /build Debug /project cmTryCompileExec
    [cmake]
    [cmake] Microsoft (R) Visual Studio Version 10.0.40219.1.
    [cmake] Copyright (C) Microsoft Corp. All rights reserved.
    [cmake] 1>------ Build started: Project: cmTryCompileExec, Configuration: Debug x64
    [cmake] ------
    [cmake] 1> Microsoft (R) C/C++ Optimizing Compiler Version 16.00.40219.01 for x64
    [cmake] 1> Copyright (C) Microsoft Corporation. All rights reserved.
    [cmake] 1>
    [cmake] 1> cl /c /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D _DEBUG /D
    [cmake] "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise
    [cmake] /Zc:wchar_t /Zc:forScope /GR /Fo"cmTryCompileExec.dir\Debug\\"
    [cmake] /Fd"C:/Users/myname/Workspace/myproject/Services/myprojectCommon/build/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec.pdb"
    [cmake] /Gd /TP /errorReport:prompt
    [cmake] "C:\Users\myname\Workspace\myproject\Services\myprojectCommon\build\CMakeFiles\CMakeTmp\testCXXCompiler.cxx"
    [cmake] /Zm1000
    [cmake] 1>
    [cmake] 1> testCXXCompiler.cxx
    [cmake] 1> cmTryCompileExec.vcxproj ->
    [cmake] C:\Users\myname\Workspace\myproject\Services\myprojectCommon\build\CMakeFiles\CMakeTmp\Debug\cmTryCompileExec.exe
    [cmake] 1>LINK : fatal error LNK1201: error writing to program database
    [cmake] 'C:\Users\myname\Workspace\myproject\Services\myprojectCommon\build\CMakeFiles\CMakeTmp\Debug\cmTryCompileExec.pdb';
    [cmake] check for insufficient disk space, invalid path, or insufficient privilege
    [cmake] ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
    [cmake] ==========
    [cmake]
    [cmake]
    [cmake] CMake will not be able to correctly generate this project.
    [cmake] Call Stack (most recent call first):
    [cmake] CMakeLists.txt:2 (project)
    [cmake] -- Configuring incomplete, errors occurred!
(0028553)
Bill Hoffman (manager)
2012-02-10 16:37

You are having a different problem:

C:\Users\myname\Workspace\myproject\Services\myprojectCommon\build\CMakeFiles\CMakeTmp\Debug\cmTryCompileExec.exe
    [cmake] 1>LINK : fatal error LNK1201: error writing to program database
    [cmake] 'C:\Users\myname\Workspace\myproject\Services\myprojectCommon\build\CMakeFiles\CMakeTmp\Debug\cmTryCompileExec.pdb';
    [cmake] check for insufficient disk space, invalid path, or insufficient privilege


For some reason you can not create the .pdb file.
(0028574)
kstrike155 (reporter)
2012-02-13 12:29
edited on: 2012-02-13 12:42

Any idea why? It's so random... should I make a trouble ticket of my own? I get the same error *only when I run the build a second time* for the tutorial posted here.

EDIT: Additionally, reverting to 2.8.5 RC2 SOLVES the problem.

(0028576)
Bill Hoffman (manager)
2012-02-13 12:42
edited on: 2012-02-13 12:45

Could be anti-virus. Also is likely related to 12957


Does this fix the problem for you:

cmake -DCMAKE_MAKE_PROGRAM=C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe -G "Visual Studio 10" ..

(0028577)
kstrike155 (reporter)
2012-02-13 13:05
edited on: 2012-02-13 13:08

Surprisingly yes that seems to solve the issue. I thought this was solved using the above patch? Looking at Modules/CMakeVS10FindMake.cmake shows that the patch has been integrated.

EDIT: Actually, it *doesn't* appear to work if you force usage of 64-bit.

This works:
cmake -DCMAKE_MAKE_PROGRAM=C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe -G "Visual Studio 10 Win64" ../
This does NOT work:
cmake -DCMAKE_MAKE_PROGRAM=C:/Windows/Microsoft.NET/Framework64/v4.0.30319/MSBuild.exe -G "Visual Studio 10 Win64" ../

(0028578)
Bill Hoffman (manager)
2012-02-13 13:14

So, the fix was to stop using VSExpress when MSBuild is an option. We still use devenv when the full VS is installed not the express version. You are the first person to have a serious issue like this with devenv and not vsexpress. We run all sorts of nightly testing and none of it fails like it is for you... Not sure what is different about your machine.
(0028619)
Brad King (manager)
2012-02-17 13:19

The patch from 0012957:0028618 might resolve this problem. It teaches CMake to use a random suffix on the cmTryCompileExec file names so that multiple successive tests do not clobber each other if the OS holds on to old files for any reason.
(0028912)
kstrike155 (reporter)
2012-03-13 19:44

Unfortunately that patch still doesn't solve the problem. I still get random failures (and random successes).

Somebody mentioned that it could be antivirus interfering, but I work in a corporate setting and don't have access to change those settings.

FWIW the same scripts work just fine on another computer running the same OS and same Visual Studio, but without a virus scanner.
(0034482)
Brad King (manager)
2013-11-19 11:22

I've just completed a sweeping overhaul of how CMake selects a tool to launch the generated native build system (commit range e650225d..4cce44b6). The main commit that may relate to this issue is:

 VS: Switch to internal CMAKE_MAKE_PROGRAM lookup by generators
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=558c74d0 [^]

For VS we now pick the default build tool as late as possible, even after generation of the project is completed. For VS >= 10 we pick MSBuild unless the user sets CMAKE_MAKE_PROGRAM manually or the .sln references Intel Fortran .vfproj files.
(0041886)
Kitware Robot (administrator)
2016-06-10 14:28

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2011-07-29 15:01 Utkarsh Ayachit Source_changeset_attached => VTK master 0e19dd3d
2011-07-29 15:01 Utkarsh Ayachit Source_changeset_attached => VTK master bb9fd605
2011-07-29 15:01 Utkarsh Ayachit Source_changeset_attached => VTK master 8ebe8f0c
2011-08-18 04:27 Roland Richter New Issue
2011-08-18 04:27 Roland Richter File Added: CMakeTutorial.zip
2011-08-18 04:53 Bill Hoffman Note Added: 0027229
2011-08-18 07:38 Roland Richter Note Added: 0027230
2011-08-18 08:34 Bill Hoffman Note Added: 0027231
2011-08-18 08:34 Bill Hoffman Assigned To => Bill Hoffman
2011-08-18 08:34 Bill Hoffman Status new => assigned
2011-08-18 09:45 Roland Richter Note Added: 0027232
2011-08-18 10:09 Bill Hoffman Note Added: 0027233
2011-08-18 10:32 Bill Hoffman File Added: patch_vcexpress.txt
2011-08-18 10:34 Bill Hoffman Note Added: 0027234
2011-08-18 11:19 Zack Galbreath Source_changeset_removed VTK master 8ebe8f0c =>
2011-08-18 11:20 Zack Galbreath Source_changeset_removed VTK master bb9fd605 =>
2011-08-18 11:20 Zack Galbreath Source_changeset_removed VTK master 0e19dd3d =>
2011-08-18 12:32 Bill Hoffman Note Added: 0027239
2011-08-19 02:36 Roland Richter Note Added: 0027244
2011-09-30 13:01 Utkarsh Ayachit Source_changeset_attached => VTK master d3479aaa
2011-09-30 13:01 Utkarsh Ayachit Source_changeset_attached => VTK master 1b00f407
2011-09-30 13:01 Nathan Fabian Source_changeset_attached => VTK master d7df79fb
2012-02-10 16:07 kstrike155 Note Added: 0028552
2012-02-10 16:37 Bill Hoffman Note Added: 0028553
2012-02-13 12:29 kstrike155 Note Added: 0028574
2012-02-13 12:42 kstrike155 Note Edited: 0028574
2012-02-13 12:42 Bill Hoffman Note Added: 0028576
2012-02-13 12:43 Bill Hoffman Relationship added related to 0012957
2012-02-13 12:45 Bill Hoffman Note Edited: 0028576
2012-02-13 13:05 kstrike155 Note Added: 0028577
2012-02-13 13:08 kstrike155 Note Edited: 0028577
2012-02-13 13:14 Bill Hoffman Note Added: 0028578
2012-02-17 13:19 Brad King Note Added: 0028619
2012-03-13 19:44 kstrike155 Note Added: 0028912
2013-11-19 11:22 Brad King Note Added: 0034482
2016-06-10 14:28 Kitware Robot Note Added: 0041886
2016-06-10 14:28 Kitware Robot Status assigned => resolved
2016-06-10 14:28 Kitware Robot Resolution open => moved
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team