[CMake] Check for working C compiler using: Visual Studio 10 -- broken

Mateusz Loskot mateusz at loskot.net
Tue Mar 5 11:40:41 EST 2013


On 5 March 2013 15:58, Bill Hoffman <bill.hoffman at kitware.com> wrote:
> On 3/5/2013 10:45 AM, Mateusz Loskot wrote:
>>
>> Here is my environment:
>> - Windows 7 (64-bit).
>> - CMake 2.8.10.2
>> - Visual Studio 2010 Professional
>> - Visual Studio 2012 Professional (Update 1)
>>
>> All VS installations work well with hand-crafted projects,
>> no problems building from IDE, no problems building from
>> corresponding command line prompts.
>>
>> I launch Visual Studio Command Prompt (2010) and try to configure
>> CMake-based project, and I'm getting the status from the subject line.
>>
>> Here is detailed CMake output:
>>
>>
>> ----------------------------------------------------------------------------------------------------
>> d:\dev\soci\_git\build-sqlite3>cmake -G "Visual Studio 10" ..\soci\src
>> -- The C compiler identification is MSVC 16.0.30319.1
>> -- The CXX compiler identification is MSVC 16.0.30319.1
>> -- Check for working C compiler using: Visual Studio 10
>> -- Check for working C compiler using: Visual Studio 10 -- broken
>> CMake Error at C:/Program Files (x86)/CMake
>> 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
>>    The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
>>    10.0/VC/bin/cl.exe" is not able to compile a simple test program.
>>
>>    It fails with the following output:
>>
>>     Change Dir: D:/dev/soci/_git/build-sqlite3/CMakeFiles/CMakeTmp
>>
>>    Run Build Command:C:\PROGRA~2\MICROS~2.0\Common7\IDE\devenv.com
>>    CMAKE_TRY_COMPILE.sln /build Debug /project cmTryCompileExec2214779388
>>
>>    Microsoft (R) Visual Studio Version 10.0.30319.1.
>>    Copyright (C) Microsoft Corp.  All rights reserved.
>>
>>    1>------ Build started: Project: cmTryCompileExec2214779388,
>> Configuration:
>>    Debug Win32 ------
>>
>>    1>Build started 05/03/2013 15:34:40.
>>    1>PrepareForBuild:
>>    1> Creating directory
>>    "D:\dev\soci\_git\build-sqlite3\CMakeFiles\CMakeTmp\Debug\".
>>    1>InitializeBuildStatus:
>>    1> Creating
>>
>> "cmTryCompileExec2214779388.dir\Debug\cmTryCompileExec2214779388.unsuccessfulbuild"
>>    because "AlwaysCreate" was specified.
>>    1>ClCompile:
>>    1> Microsoft (R) 32-bit C/C++ Optimizing Compiler Version
>> 16.00.30319.01 for 80x86
>>    1> Copyright (C) Microsoft Corporation.  All rights reserved.
>>    1>
>>    1> cl /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D
>>    "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise
>>    /Zc:wchar_t /Zc:forScope /Fo"cmTryCompileExec2214779388.dir\Debug\\"
>>
>> /Fd"D:/dev/soci/_git/build-sqlite3/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec2214779388.pdb"
>>    /Gd /TC /analyze- /errorReport:prompt testCCompiler.c /Zm1000
>>    1>
>>    1> testCCompiler.c
>>    1>LINK : fatal error LNK1123: failure during conversion to COFF:
>> file invalid or corrupt
>>    1>
>>    1>Build FAILED.
>>    1>
>>    1>Time Elapsed 00:00:00.44
>>    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
>> ==========
>>
>>    CMake will not be able to correctly generate this project.
>> Call Stack (most recent call first):
>>    CMakeLists.txt:15 (project)
>>
>> -- Configuring incomplete, errors occurred!
>>
>> d:\dev\soci\_git\build-sqlite3>
>>
>> ----------------------------------------------------------------------------------------------------
>>
>>
>> I have searched Web and this kind of error seems to be recurring,
>> some users even suggest to uninstall/reinstall Visual Studio...
>> Note, both VS versions work well with projects I already have.
>>
>> I'm confused, what is the correct solution?
>
>
> I found this:
>
> http://stackoverflow.com/questions/10888391/link-fatal-error-lnk1123-failure-during-conversion-to-coff-file-invalid-or-c

Bill,

I think I know this error well, but I experienced that at different occasion
not related to CMake. AFAIK, it simply means object files or binaries
being linked are
incompatible (i.e. one .obj built with VC++ from VS2010, the other
.obj by VS2012)

> You could run cmake --debug-trycompile, then load the .sln file in the
> CMakeTmp directory with the IDE and see why it does not work.  Sounds like a
> .NET version issue.  I would try some of the stuff in that stackoverflow link.

Nice tip with the solution in the CMakeTmp, I had no idea about it.

I figured out that the VS2010 project there, cmTryCompileExec3417082516.vcxproj,
specifies for linker  /INCREMENTAL:YES
If I change to /INCREMENTAL:NO, then it builds.

Still not sure how the VS2010/VS2012 toolsets interfere here,
but it looks like this mess is not related to any problems with CMake.

Thanks!

Best regards.
--
Mateusz Loskot, http://mateusz.loskot.net


More information about the CMake mailing list