System Info: Windows 7, 64 bit, Visual Studio 2010 Ultimate, CMake 3.0.0
I am following this tutorial to build opencv library from source.
The problem occurs at CMake stage:
The CXX compiler identification is MSVC 16.0.30319.1
The C compiler identification is MSVC 16.0.30319.1
Check for working CXX compiler using: Visual Studio 10 2010 Win64
Check for working CXX compiler using: Visual Studio 10 2010 Win64 -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.0/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler "c:/Program Files (x86)/Microsoft Visual Studio
10.0/VC/bin/x86_amd64/cl.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Hesh/Documents/opencv_built/CMakeFiles/CMakeTmp
Run Build
Command:"C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe"
"cmTryCompileExec819411847.vcxproj" "/p:Configuration=Debug"
"/p:VisualStudioVersion=10.0"
Microsoft (R) Build Engine version 4.0.30319.17929
[Microsoft .NET Framework, version 4.0.30319.17929]
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 7/22/2014 9:18:36 AM.
Project
"C:\Users\Hesh\Documents\opencv_built\CMakeFiles\CMakeTmp\cmTryCompileExec819411847.vcxproj"
on node 1 (default targets).
PrepareForBuild:
Creating directory "cmTryCompileExec819411847.dir\Debug\".
Creating directory "C:\Users\Hesh\Documents\opencv_built\CMakeFiles\CMakeTmp\Debug\".
InitializeBuildStatus:
Creating "cmTryCompileExec819411847.dir\Debug\cmTryCompileExec819411847.unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\CL.exe /c /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /GR /Fo"cmTryCompileExec819411847.dir\Debug\\" /Fd"cmTryCompileExec819411847.dir\Debug\vc100.pdb" /Gd /TP /errorReport:queue testCXXCompiler.cxx
Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
cl /c /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /GR /Fo"cmTryCompileExec819411847.dir\Debug\\" /Fd"cmTryCompileExec819411847.dir\Debug\vc100.pdb" /Gd /TP /errorReport:queue testCXXCompiler.cxx
testCXXCompiler.cxx
ManifestResourceCompile:
c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\rc.exe /nologo /fo"cmTryCompileExec819411847.dir\Debug\cmTryCompileExec819411847.exe.embed.manifest.res" cmTryCompileExec819411847.dir\Debug\cmTryCompileExec819411847_manifest.rc
Link:
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\Hesh\Documents\opencv_built\CMakeFiles\CMakeTmp\Debug\cmTryCompileExec819411847.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /ManifestFile:"cmTryCompileExec819411847.dir\Debug\cmTryCompileExec819411847.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:/Users/Hesh/Documents/opencv_built/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec819411847.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/Users/Hesh/Documents/opencv_built/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec819411847.lib" /MACHINE:X64 cmTryCompileExec819411847.dir\Debug\cmTryCompileExec819411847.exe.embed.manifest.res
cmTryCompileExec819411847.dir\Debug\testCXXCompiler.obj /machine:x64 /debug
LINK : fatal error LNK1123: failure during conversion to COFF: file invalid
or corrupt
[C:\Users\Hesh\Documents\opencv_built\CMakeFiles\CMakeTmp\cmTryCompileExec819411847.vcxproj]
Done Building Project
"C:\Users\Hesh\Documents\opencv_built\CMakeFiles\CMakeTmp\cmTryCompileExec819411847.vcxproj"
(default targets) -- FAILED.
Build FAILED.
"C:\Users\Hesh\Documents\opencv_built\CMakeFiles\CMakeTmp\cmTryCompileExec819411847.vcxproj"
(default target) (1) ->
(Link target) ->
LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt [C:\Users\Hesh\Documents\opencv_built\CMakeFiles\CMakeTmp\cmTryCompileExec819411847.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.85
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:45 (project)
Configuring incomplete, errors occurred!
See also "C:/Users/Hesh/Documents/opencv_built/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Hesh/Documents/opencv_built/CMakeFiles/CMakeError.log".
I have put the path for compiler for C and C++ as:
C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe
Another thing I have noticed that all my folders are read-only, even if I manually un-check it in properties. The OpenCV source is also read-only. Could this be the reason for the above error ?