[cmake-developers] [CMake 0012957]: Compiler tests randomly fail on Win7

Mantis Bug Tracker mantis at public.kitware.com
Sun Feb 12 09:58:07 EST 2012

The following issue has been SUBMITTED. 
Reported By:                Andras Lasso
Assigned To:                
Project:                    CMake
Issue ID:                   12957
Category:                   CMake
Reproducibility:            random
Severity:                   major
Priority:                   normal
Status:                     new
Date Submitted:             2012-02-12 09:58 EST
Last Modified:              2012-02-12 09:58 EST
Summary:                    Compiler tests randomly fail on Win7
The compiler tests during configure step randomly fail on Windows7. The problems
are reprodusible with older CMake versions (CMake 2.8.6, 2.8.5, and 2.8.4 - I
haven't tried with any older).

The failure may happen in any phase of the process:

=> change dir:

CMake Error at c:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
  The C compiler "cl" is not able to compile a simple test program.
  It fails with the following output:
   Change Dir:

=> linking (cannot open the exe or pdb):

  Microsoft (R) Visual Studio Version 9.0.21022.8.
  Copyright (C) Microsoft Corp.  All rights reserved.
  1>------ Build started: Project: cmTryCompileExec, Configuration: Debug
  Win32 ------
  1>Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for
  1>Copyright (C) Microsoft Corporation.  All rights reserved.
  1>cl /Od /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "CMAKE_INTDIR=\"Debug\""
  /D "_MBCS" /FD /RTC1 /MDd /Fo"cmTryCompileExec.dir\Debug\\"
  /W3 /c /Zi /TC /Zm1000
  1> ".\testCCompiler.c"
  1>Compiling manifest to resources...
  1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
  1>Copyright (C) Microsoft Corporation.  All rights reserved.
  1>LINK : fatal error LNK1104: cannot open file
  Run Build Command:c:\PROGRA~2\MICROS~1.0\Common7\IDE\devenv.com
  CMAKE_TRY_COMPILE.sln /build Debug /project cmTryCompileExec

Although it's not an acceptable workaround, I've turned of the antivirus and
file indexing features and it seemed to reduce the occurrence of the error, but
it kept happening. It seems that if anything runs in parallel on the computer
then it increases the chance of error. It happens on several computers (desktop,
laptop), in different institutions (it's not likely to be caused by some
specific local software or malware infection; it could still be caused by
utilities that are commonly found on developer's computers). I think it's the
same issue as the one kstrike155 reported in

The problem is particularly severe when building complex projects (with several
external projects), such as Slicer, because:
-several external projects build run in parallel (therefore the chance of
failure is high),
-tens of projects are built (therefore it is quite likely that one of them
fails), and
-if there is an error in configuration phase then even a rebuild of the project
doesn't solve the problem (because CMakeCache contains the result of some
incorrect compiler test).

In a superbuild environment the workaround is quite complex: identiy the failed
project, delete the CMakeCache.txt of that project, reconfigure the project with
superbuild (not by manually running CMake, because then some CMake variables may
not be set correctly), rebuild.

Steps to Reproduce: 
Repeat the following steps many times:
1. Delete the CMakeCache.txt (del cmakecache.txt)
2. Run a cmake to configure a project ("c:\Program Files (x86)\CMake
2.8\bin\cmake.exe" ../cmcurl) 

Do some other work in parallel to make the failure happen sooner. If there is
intensive work in the background then the failure rate is about 10-20%.

Issue History 
Date Modified    Username       Field                    Change               
2012-02-12 09:58 Andras Lasso   New Issue                                    

More information about the cmake-developers mailing list