[CMake] CMake cannot build a simple example on one of our
computers
Marcus
yhadin002 at sneakemail.com
Wed Dec 5 15:50:07 EST 2007
>> CMake will not configure on one of our development machines. When I run
>> CMake on this machine, it initially it says:
>>
>> -- Check for working C compiler: cl
>>
>> Then it crunches for about 15 minutes, and eventually displays the message:
>>
>> -- Check for working C compiler: cl - broken
>> CMake Error: The C compiler "cl" is not able to compile a simple test
>> program.
>>
>> If I look inside the binary output directory while CMake is running, I can
>> see that the CMakeFiles directory is being expanded recursively like this:
>>
>> C:\temp\CMakeExample-bin\CMakeFiles\CMakeTmp\CMakeFiles\CMakeTmp\CMakeFiles\CMakeTmp\CMakeFiles\CMakeTmp\...
>>
>> Perhaps it is getting stuck in infinite recursion?
>>
> As you have seen this has happened in a few cases, but we have never been able
> to reproduce it at Kitware. If you are willing to do help try to figure this
> out, I will work with you. It might help if you could build CMake from
> source, can you use the nmake generator on the broken system?
Thanks Bill!
I have built CMake from source using Visual Studio 2005. Since CMake
would not run on the problematic machine, I had to generate the CMake
project files on another computer first.
I built and installed CMake into the directory <C:\Program
Files\CMake-2.5.20071205>. Then I set up the debugger as follows:
Command: C:\Program Files\CMake-2.5.20071205\bin\cmake.exe
Command Arguments: -G "Visual Studio 8 2005" C:\temp\CMakeExample
Working Directory: C:\temp\CMakeExample-bin
When I started the debugger, it displayed the following message and the
hard-disk started crunching:
-- Check for working C compiler: C:/Program Files/Microsoft Visual
Studio 8/VC/bin/cl.exe
Then I tried to break in the debugger, and it said:
"The process appears to be deadlocked (or is not running any user-mode
code). All threads have been stopped."
The call stack looked like this:
cmake.exe!kwsysProcessGetTimeoutTime(cmsysProcess_s *
cp=0x00000002, double * userTimeout=0x016b61f8, _LARGE_INTEGER *
timeoutTime=0x00000000) Line 2317 + 0xf bytes C
cmake.exe!cmsysProcess_WaitForData(cmsysProcess_s *
cp=0x01771028, char * * data=0x0127d070, int * length=0x0127d064, double
* userTimeout=0x00000000) Line 1281 + 0x22 bytes C
cmake.exe!cmSystemTools::RunSingleCommand(const char *
command=0x0176ff30,
std::basic_string<char,std::char_traits<char>,std::allocator<char> > *
output="", int * retVal=0x0127d1d4, const char * dir=0x00000000, bool
verbose=false, double timeout=0.00000000000000000) Line 610 + 0x16
bytes C++
cmake.exe!cmGlobalGenerator::Build(const char *
__formal=0x016ef038, const char * bindir=0x016ef038, const char *
projectName=0x0081a96c, const char * target=0x0176cd58,
std::basic_string<char,std::char_traits<char>,std::allocator<char> > *
output="", const char * makeCommandCSTR=0x0176cfb8, const char *
config=0x00000000, bool clean=false, bool fast=true, double
timeout=0.00000000000000000) Line 1040 + 0x30 bytes C++
cmake.exe!cmGlobalGenerator::TryCompile(const char *
srcdir=0x016ef038, const char * bindir=0x016ef038, const char *
projectName=0x0081a96c, const char * target=0x0081a980,
std::basic_string<char,std::char_traits<char>,std::allocator<char> > *
output="", cmMakefile * mf=0x016ca410) Line 953 + 0x59 bytes C++
cmake.exe!cmMakefile::TryCompile(const char * srcdir=0x016ef038,
const char * bindir=0x016ef038, const char * projectName=0x0081a96c,
const char * targetName=0x0081a980, const
std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > > * cmakeArgs=[1]("-DCMAKE_DO_TRY_COMPILE=TRUE"),
std::basic_string<char,std::char_traits<char>,std::allocator<char> > *
output="") Line 2285 + 0x41 bytes C++
cmake.exe!cmCoreTryCompile::TryCompileCode(const
std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > > &
argv=[5]("CMAKE_C_COMPILER_WORKS","C:/temp/CMakeExample-bin","C:/temp/CMakeExample-bin/CMakeFiles/CMakeTmp/testCCompiler.c",...,...))
Line 285 + 0x38 bytes C++
cmake.exe!cmTryCompileCommand::InitialPass(const
std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > > &
argv=[5]("CMAKE_C_COMPILER_WORKS","C:/temp/CMakeExample-bin","C:/temp/CMakeExample-bin/CMakeFiles/CMakeTmp/testCCompiler.c",...,...))
Line 30 C++
cmake.exe!cmCommand::InvokeInitialPass(const
std::vector<cmListFileArgument,std::allocator<cmListFileArgument> > &
args=[5]({Value="CMAKE_C_COMPILER_WORKS" Quoted=false
FilePath=0x016f5e68 "C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/CMakeTestCCompiler.cmake"
...},...)) Line 67 + 0x13 bytes C++
cmake.exe!cmMakefile::ExecuteCommand(const cmListFileFunction &
lff={...}) Line 322 + 0x1c bytes C++
cmake.exe!cmMakefile::ReadListFile(const char *
filename_in=0x00000000, const char * external_in=0x01701e28,
std::basic_string<char,std::char_traits<char>,std::allocator<char> > *
fullPath=0x00000000) Line 482 C++
cmake.exe!cmGlobalGenerator::EnableLanguage(const
std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > > & languages=[2]("C","CXX"), cmMakefile * mf=0x016ca410, bool
__formal=false) Line 438 + 0x22 bytes C++
cmake.exe!cmGlobalVisualStudio7Generator::EnableLanguage(const
std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > > & lang=[2]("C","CXX"), cmMakefile * mf=0x016ca410, bool
optional=false) Line 44 C++
cmake.exe!cmMakefile::EnableLanguage(const
std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > > & lang=[2]("C","CXX"), bool optional=false) Line 2195 + 0x2c
bytes C++
cmake.exe!cmProjectCommand::InitialPass(const
std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > > & args=[1]("HELLO")) Line 76 C++
cmake.exe!cmCommand::InvokeInitialPass(const
std::vector<cmListFileArgument,std::allocator<cmListFileArgument> > &
args=[1]({Value="HELLO" Quoted=false FilePath=0x016ccdb8
"C:/temp/CMakeExample/CMakeLists.txt" ...})) Line 67 + 0x13 bytes
C++
cmake.exe!cmMakefile::ExecuteCommand(const cmListFileFunction &
lff={...}) Line 322 + 0x1c bytes C++
cmake.exe!cmMakefile::ReadListFile(const char *
filename_in=0x016ccdb8, const char * external_in=0x00000000,
std::basic_string<char,std::char_traits<char>,std::allocator<char> > *
fullPath=0x00000000) Line 482 C++
cmake.exe!cmLocalGenerator::Configure() Line 84 C++
cmake.exe!cmGlobalGenerator::Configure() Line 710 + 0xf bytes
C++
cmake.exe!cmGlobalVisualStudio7Generator::Configure() Line 756
C++
cmake.exe!cmGlobalVisualStudio8Generator::Configure() Line 71
C++
cmake.exe!cmake::Configure() Line 1957 + 0x1d bytes C++
cmake.exe!cmake::Run(const
std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > > & args=[4]("C:\Program
Files\CMake-2.5.20071205\bin\cmake.exe","-G","Visual Studio 8
2005","C:\temp\CMakeExample"), bool noconfigure=false) Line 2137 + 0x8
bytes C++
cmake.exe!do_cmake(int ac=4, char * * av=0x00256158) Line 460 +
0x19 bytes C++
cmake.exe!main(int ac=4, char * * av=0x00256158) Line 276 + 0xd
bytes C++
At this point, even though it said that all threads had been stopped,
the hard disk was still making a lot of noise. I tried using 'Attach to
Process', and I could see that several other cmake processes were
running. When I tried to attach to one of them, Visual Studio complained
that the process had already terminated -- I think they were starting
and stopping too quickly for me to catch them.
I continued debugging the program, and eventually it produced a great
mass of error messages. Unfortunately the console window automatically
closed, and I did not get to read them.
So I ran cmake again, this time using the current release version (cmake
2.4.7) without the debugger, and I captured the stdout & stderr into a
file. After about 15 minutes, it produced over 5MB of error messages,
which looked like this:
CMake Error: The C compiler "cl" is not able to compile a simple test
program.
It fails with the following output:
Microsoft (R) Visual Studio Version 8.0.50727.42.
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32
------
Checking Build System
-- Check for working C compiler: C:/Program Files/Microsoft Visual
Studio 8/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files/Microsoft Visual
Studio 8/VC/bin/cl.exe -- broken
CMake Error: The C compiler "C:/Program Files/Microsoft Visual Studio
8/VC/bin/cl.exe" is not able to compile a simple test program.
It fails with the following output:
Microsoft (R) Visual Studio Version 8.0.50727.42.
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32
------
Checking Build System
-- Check for working C compiler: C:/Program Files/Microsoft Visual
Studio 8/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files/Microsoft Visual
Studio 8/VC/bin/cl.exe -- broken
CMake Error: The C compiler "C:/Program Files/Microsoft Visual Studio
8/VC/bin/cl.exe" is not able to compile a simple test program.
It fails with the following output:
... This repeated several times, and then it produced messages in this form:
Microsoft (R) Visual Studio Version 8.0.50727.42.
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32
------
ZERO_CHECK : warning PRJ0009 : Build log could not be opened for
writing.
Make sure that the file is not open by another process and is not
write-protected.
Checking Build System
CMake Error: Could not open file for write in copy operation
C:/temp/CMakeExample-testbin/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeSystem.cmake.tmp
CMake Error: : System Error: No such file or directory
CMake Error: Error in cmake code at
C:/Program Files/CMake
2.4/share/cmake-2.4/Modules/CMakeDetermineSystem.cmake:81:
CONFIGURE_FILE Problem configuring file
Current CMake stack:
[2] C:/Program Files/CMake
2.4/share/cmake-2.4/Modules/CMakeDetermineSystem.cmake
[1]
C:/temp/CMakeExample-testbin/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeLists.txt
CMake Error: Could not open file for write in copy operation
C:/temp/CMakeExample-testbin/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeCCompiler.cmake.tmp
CMake Error: : System Error: No such file or directory
CMake Error: Error in cmake code at
C:/Program Files/CMake
2.4/share/cmake-2.4/Modules/CMakeDetermineCCompiler.cmake:94:
CONFIGURE_FILE Problem configuring file
Current CMake stack:
[2] C:/Program Files/CMake
2.4/share/cmake-2.4/Modules/CMakeDetermineCCompiler.cmake
[1]
C:/temp/CMakeExample-testbin/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeLists.txt
CMake Error: Could not find cmake module
file:C:/temp/CMakeExample-testbin/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeCCompiler.cmake
CMake Error: Could not open file for write in copy operation
C:/temp/CMakeExample-testbin/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeTmp/CMakeFiles/CMakeRCCompiler.cmake.tmp
CMake Error: : System Error: No such file or directory
CMake Error: Error in cmake code at
C:/Program Files/CMake
2.4/share/cmake-2.4/Modules/CMakeDetermineRCCompiler.cmake:46:
CONFIGURE_FILE Problem configuring file
Current CMake stack:
[4] C:/Program Files/CMake
2.4/share/cmake-2.4/Modules/CMakeDetermineRCCompiler.cmake
[3] C:/Program Files/CMake
2.4/share/cmake-2.4/Modules/Platform/Windows-cl.cmake
[2] C:/Program Files/CMake
2.4/share/cmake-2.4/Modules/CMakeCInformation.cmake
[1]
> ... can you use the nmake generator on the broken system?
Initially I could not get CMake to generate NMake Makefiles on the
problematic computer. It produced the following error:
C:\temp\CMakeExample-bin>"C:\Program
Files\CMake-2.5.20071205\bin\cmake.exe" -G "NMake Makefiles"
--debug-output C:\temp\CMakeExample
Running with debug output on.
CMake Error: Compiling the C compiler identification source file
"C:\Program
Files\CMake-2.5.20071205\share\cmake-2.5\Modules\CMakeCCompilerId.c"
failed with the following output:
The system cannot find the file specified
Called from: [2] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/CMakeDetermineCCompiler.cmake
[1] C:/temp/CMakeExample/CMakeLists.txt
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
Called from: [1] C:/temp/CMakeExample/CMakeLists.txt
CMake Error: Could not find cmake module
file:C:/temp/CMakeExample-bin/CMakeFiles/CMakeCCompiler.cmake
Called from: [1] C:/temp/CMakeExample/CMakeLists.txt
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
Called from: [1] C:/temp/CMakeExample/CMakeLists.txt
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
Called from: [1] C:/temp/CMakeExample/CMakeLists.txt
CMake Error: Could not find cmake module
file:C:/temp/CMakeExample-bin/CMakeFiles/CMakeCXXCompiler.cmake
Called from: [1] C:/temp/CMakeExample/CMakeLists.txt
CMake Error: your C compiler: "cl" was not found. Please set
CMAKE_C_COMPILER to a valid compiler path or name.
Called from: [1] C:/temp/CMakeExample/CMakeLists.txt
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
Called from: [1] C:/temp/CMakeExample/CMakeLists.txt
-- Configuring done
But after I ran vsvars32.bat, it worked perfectly. This was the result:
C:\temp\CMakeExample-bin>"C:\Program Files\Microsoft Visual Studio
8\Common7\Tools\vsvars32.bat"
Setting environment for using Microsoft Visual Studio 2005 x86 tools.
C:\temp\CMakeExample-bin>"C:\Program
Files\CMake-2.5.20071205\bin\cmake.exe" -G "NMake Makefiles"
--debug-output C:\temp\CMakeExample
Running with debug output on.
-- The C compiler identification is MSVC
Called from: [2] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/CMakeDetermineCCompiler.cmake
[1] C:/temp/CMakeExample/CMakeLists.txt
-- The CXX compiler identification is MSVC
Called from: [2] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/CMakeDetermineCXXCompiler.cmake
[1] C:/temp/CMakeExample/CMakeLists.txt
-- Check for CL compiler version
Called from: [3] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/Platform/Windows-cl.cmake
[2] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/CMakeCInformation.cmake
[1] C:/temp/CMakeExample/CMakeLists.txt
-- Check for CL compiler version - 1400
Called from: [3] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/Platform/Windows-cl.cmake
[2] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/CMakeCInformation.cmake
[1] C:/temp/CMakeExample/CMakeLists.txt
-- Check if this is a free VC compiler
Called from: [3] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/Platform/Windows-cl.cmake
[2] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/CMakeCInformation.cmake
[1] C:/temp/CMakeExample/CMakeLists.txt
-- Check if this is a free VC compiler - no
Called from: [3] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/Platform/Windows-cl.cmake
[2] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/CMakeCInformation.cmake
[1] C:/temp/CMakeExample/CMakeLists.txt
-- Check CL platform
Called from: [3] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/Platform/Windows-cl.cmake
[2] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/CMakeCInformation.cmake
[1] C:/temp/CMakeExample/CMakeLists.txt
-- Check CL platform - 32 bit
Called from: [3] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/Platform/Windows-cl.cmake
[2] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/CMakeCInformation.cmake
[1] C:/temp/CMakeExample/CMakeLists.txt
-- Check for working C compiler: C:/Program Files/Microsoft Visual
Studio 8/VC/bin/cl.exe
Called from: [2] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/CMakeTestCCompiler.cmake
[1] C:/temp/CMakeExample/CMakeLists.txt
-- Check for working C compiler: C:/Program Files/Microsoft Visual
Studio 8/VC/bin/cl.exe -- works
Called from: [2] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/CMakeTestCCompiler.cmake
[1] C:/temp/CMakeExample/CMakeLists.txt
-- Check size of void*
Called from: [2] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/CMakeTestCCompiler.cmake
[1] C:/temp/CMakeExample/CMakeLists.txt
-- Check size of void* - done
Called from: [2] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/CMakeTestCCompiler.cmake
[1] C:/temp/CMakeExample/CMakeLists.txt
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual
Studio 8/VC/bin/cl.exe
Called from: [2] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/CMakeTestCXXCompiler.cmake
[1] C:/temp/CMakeExample/CMakeLists.txt
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual
Studio 8/VC/bin/cl.exe -- works
Called from: [2] C:/Program
Files/CMake-2.5.20071205/share/cmake-2.5/Modules/CMakeTestCXXCompiler.cmake
[1] C:/temp/CMakeExample/CMakeLists.txt
Entering C:/temp/CMakeExample/Hello
Called from: [1] C:/temp/CMakeExample/CMakeLists.txt
Returning to C:/temp/CMakeExample
Called from: [1] C:/temp/CMakeExample/CMakeLists.txt
Entering C:/temp/CMakeExample/Demo
Called from: [1] C:/temp/CMakeExample/CMakeLists.txt
Returning to C:/temp/CMakeExample
Called from: [1] C:/temp/CMakeExample/CMakeLists.txt
-- Configuring done
-- Generating C:/temp/CMakeExample-bin
-- Generating C:/temp/CMakeExample-bin/Hello
-- Generating C:/temp/CMakeExample-bin/Demo
-- Generating done
-- Build files have been written to: C:/temp/CMakeExample-bin
Unfortunately, this problematic computer belongs to my team-mate, so I
had to stop working on it this afternoon. Hopefully I'll get another
chance to debug it tomorrow.
Can you suggest any further experiments?
Do you have any idea what the problem could be?
Thanks,
Marcus
More information about the CMake
mailing list