CMake ignores $CC and $CXX?












0















I am trying to compile OpenCV from source on Windows 10 because I thought this to be the way to incorporate the surface matching module into the library. I tried to follow the installation instructions here but when I try to execute the installOCV.sh from inside the gitbash like described, it fails halfway when CMake tries to testcompile with the C and C++ compiler. The script output is this:



$ ./installOCV.sh
Already up to date.
Current branch master is up to date.
Already up to date.
Current branch master is up to date.
/c/lib/Build/opencv /c/lib
-- Selecting Windows SDK version to target Windows 10.0.17134.
-- The CXX compiler identification is unknown
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:131 (project):
No CMAKE_CXX_COMPILER could be found.

CMake Error at CMakeLists.txt:131 (project):
No CMAKE_C_COMPILER could be found.

-- Configuring incomplete, errors occurred!
See also "C:/lib/Build/opencv/CMakeFiles/CMakeOutput.log".
See also "C:/lib/Build/opencv/CMakeFiles/CMakeError.log".


and CMakeError.log displays the following (sorry German):



Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler:
Build flags:
Id flags:

The output was:
1
Microsoft (R)-Buildmodul, Version 14.0.25420.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Der Buildvorgang wurde am 18.01.2019 15:09:13 gestartet.
Projekt "C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" auf Knoten "1" (Standardziele).
PrepareForBuild:
Das Verzeichnis "Debug" wird erstellt.
Das Verzeichnis "DebugCompilerIdCXX.tlog" wird erstellt.
InitializeBuildStatus:
"DebugCompilerIdCXX.tlogunsuccessfulbuild" wird erstellt, da "AlwaysCreate" angegeben wurde.
ClCompile:
CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\" /Fd"Debugvc140.pdb" /Gd /TP /errorReport:queue CMakeCXXCompilerId.cpp
TRACKER : Fehler TRK0005: Fehler beim Suchen von "CL.exe". Das System kann die angegebene Datei nicht finden.


C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj]
Die Erstellung des Projekts "C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" ist abgeschlossen (Standardziele) -- FEHLER.

Fehler beim Buildvorgang.

"C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" (Standardziel) (1) ->
(ClCompile Ziel) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj]

0 Warnung(en)
1 Fehler

Verstrichene Zeit 00:00:00.26


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler:
Build flags:
Id flags:

The output was:
1
Microsoft (R)-Buildmodul, Version 14.0.25420.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Der Buildvorgang wurde am 18.01.2019 15:09:14 gestartet.
Projekt "C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" auf Knoten "1" (Standardziele).
PrepareForBuild:
Das Verzeichnis "Debug" wird erstellt.
Das Verzeichnis "DebugCompilerIdCXX.tlog" wird erstellt.
InitializeBuildStatus:
"DebugCompilerIdCXX.tlogunsuccessfulbuild" wird erstellt, da "AlwaysCreate" angegeben wurde.
ClCompile:
CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\" /Fd"Debugvc140.pdb" /Gd /TP /errorReport:queue CMakeCXXCompilerId.cpp
TRACKER : Fehler TRK0005: Fehler beim Suchen von "CL.exe". Das System kann die angegebene Datei nicht finden.


C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj]
Die Erstellung des Projekts "C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" ist abgeschlossen (Standardziele) -- FEHLER.

Fehler beim Buildvorgang.

"C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" (Standardziel) (1) ->
(ClCompile Ziel) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj]

0 Warnung(en)
1 Fehler

Verstrichene Zeit 00:00:00.26


Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler:
Build flags:
Id flags:

The output was:
1
Microsoft (R)-Buildmodul, Version 14.0.25420.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Der Buildvorgang wurde am 18.01.2019 15:09:14 gestartet.
Projekt "C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" auf Knoten "1" (Standardziele).
PrepareForBuild:
Das Verzeichnis "Debug" wird erstellt.
Das Verzeichnis "DebugCompilerIdC.tlog" wird erstellt.
InitializeBuildStatus:
"DebugCompilerIdC.tlogunsuccessfulbuild" wird erstellt, da "AlwaysCreate" angegeben wurde.
ClCompile:
CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\" /Fd"Debugvc140.pdb" /Gd /TC /errorReport:queue CMakeCCompilerId.c
TRACKER : Fehler TRK0005: Fehler beim Suchen von "CL.exe". Das System kann die angegebene Datei nicht finden.


C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj]
Die Erstellung des Projekts "C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" ist abgeschlossen (Standardziele) -- FEHLER.

Fehler beim Buildvorgang.

"C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" (Standardziel) (1) ->
(ClCompile Ziel) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj]

0 Warnung(en)
1 Fehler

Verstrichene Zeit 00:00:00.28


Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler:
Build flags:
Id flags:

The output was:
1
Microsoft (R)-Buildmodul, Version 14.0.25420.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Der Buildvorgang wurde am 18.01.2019 15:09:15 gestartet.
Projekt "C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" auf Knoten "1" (Standardziele).
PrepareForBuild:
Das Verzeichnis "Debug" wird erstellt.
Das Verzeichnis "DebugCompilerIdC.tlog" wird erstellt.
InitializeBuildStatus:
"DebugCompilerIdC.tlogunsuccessfulbuild" wird erstellt, da "AlwaysCreate" angegeben wurde.
ClCompile:
CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\" /Fd"Debugvc140.pdb" /Gd /TC /errorReport:queue CMakeCCompilerId.c
TRACKER : Fehler TRK0005: Fehler beim Suchen von "CL.exe". Das System kann die angegebene Datei nicht finden.


C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj]
Die Erstellung des Projekts "C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" ist abgeschlossen (Standardziele) -- FEHLER.

Fehler beim Buildvorgang.

"C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" (Standardziel) (1) ->
(ClCompile Ziel) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj]

0 Warnung(en)
1 Fehler

Verstrichene Zeit 00:00:00.27


Obviously neither $CC nor $CXX are taken into consideration by CMake, although they exist:



$ echo $CC
c:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.11.25503/bin/Hostx64/x64/cl.exe

mark@zws103 MINGW64 /c/lib
$ echo $CXX
c:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.11.25503/bin/Hostx64/x64/cl.exe


PS: of course there could be some problem with spaces in filenames, but I tried gcc with a no-space path and the result was literally the same.



$ $CC
bash: c:/Program: No such file or directory

mark@zws103 MINGW64 /c/lib
$ "$CC"
Microsoft (R) C/C++-Optimierungscompiler Version 19.11.25508.2 f¦r x64
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Syntax: cl [ Option... ] Dateiname... [ /link Linkeroption... ]









share|improve this question























  • Try not setting CC or CCX when using Visual Studio and see if it fixes the issue. It probably interferes with the normal operation of Visual Studio tools like MSBuild. Normally you don't need to set these variables.

    – Fred
    Jan 18 at 14:23











  • I think that $CC and $CXX are not the correct environment variables. Set $CMAKE_C_COMPILER and $CMAKE_CXX_COMPILER instead.

    – BHawk
    Jan 18 at 15:27











  • @BHawk sorry, doesn't change anything. Same error :(. I deleted the whole tree so that no leftovers in a cache file would cause problems.

    – Vroomfondel
    Jan 18 at 15:34











  • Are you using Visual Studio 2015?

    – BHawk
    Jan 18 at 15:39






  • 1





    You will need to change the line in installOCV.sh to reflect that: CMAKE_CONFIG_GENERATOR="Visual Studio 14 2015 Win64" should be changed to CMAKE_CONFIG_GENERATOR="Visual Studio 15 2017 Win64"

    – BHawk
    Jan 18 at 15:45
















0















I am trying to compile OpenCV from source on Windows 10 because I thought this to be the way to incorporate the surface matching module into the library. I tried to follow the installation instructions here but when I try to execute the installOCV.sh from inside the gitbash like described, it fails halfway when CMake tries to testcompile with the C and C++ compiler. The script output is this:



$ ./installOCV.sh
Already up to date.
Current branch master is up to date.
Already up to date.
Current branch master is up to date.
/c/lib/Build/opencv /c/lib
-- Selecting Windows SDK version to target Windows 10.0.17134.
-- The CXX compiler identification is unknown
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:131 (project):
No CMAKE_CXX_COMPILER could be found.

CMake Error at CMakeLists.txt:131 (project):
No CMAKE_C_COMPILER could be found.

-- Configuring incomplete, errors occurred!
See also "C:/lib/Build/opencv/CMakeFiles/CMakeOutput.log".
See also "C:/lib/Build/opencv/CMakeFiles/CMakeError.log".


and CMakeError.log displays the following (sorry German):



Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler:
Build flags:
Id flags:

The output was:
1
Microsoft (R)-Buildmodul, Version 14.0.25420.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Der Buildvorgang wurde am 18.01.2019 15:09:13 gestartet.
Projekt "C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" auf Knoten "1" (Standardziele).
PrepareForBuild:
Das Verzeichnis "Debug" wird erstellt.
Das Verzeichnis "DebugCompilerIdCXX.tlog" wird erstellt.
InitializeBuildStatus:
"DebugCompilerIdCXX.tlogunsuccessfulbuild" wird erstellt, da "AlwaysCreate" angegeben wurde.
ClCompile:
CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\" /Fd"Debugvc140.pdb" /Gd /TP /errorReport:queue CMakeCXXCompilerId.cpp
TRACKER : Fehler TRK0005: Fehler beim Suchen von "CL.exe". Das System kann die angegebene Datei nicht finden.


C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj]
Die Erstellung des Projekts "C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" ist abgeschlossen (Standardziele) -- FEHLER.

Fehler beim Buildvorgang.

"C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" (Standardziel) (1) ->
(ClCompile Ziel) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj]

0 Warnung(en)
1 Fehler

Verstrichene Zeit 00:00:00.26


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler:
Build flags:
Id flags:

The output was:
1
Microsoft (R)-Buildmodul, Version 14.0.25420.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Der Buildvorgang wurde am 18.01.2019 15:09:14 gestartet.
Projekt "C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" auf Knoten "1" (Standardziele).
PrepareForBuild:
Das Verzeichnis "Debug" wird erstellt.
Das Verzeichnis "DebugCompilerIdCXX.tlog" wird erstellt.
InitializeBuildStatus:
"DebugCompilerIdCXX.tlogunsuccessfulbuild" wird erstellt, da "AlwaysCreate" angegeben wurde.
ClCompile:
CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\" /Fd"Debugvc140.pdb" /Gd /TP /errorReport:queue CMakeCXXCompilerId.cpp
TRACKER : Fehler TRK0005: Fehler beim Suchen von "CL.exe". Das System kann die angegebene Datei nicht finden.


C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj]
Die Erstellung des Projekts "C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" ist abgeschlossen (Standardziele) -- FEHLER.

Fehler beim Buildvorgang.

"C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" (Standardziel) (1) ->
(ClCompile Ziel) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj]

0 Warnung(en)
1 Fehler

Verstrichene Zeit 00:00:00.26


Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler:
Build flags:
Id flags:

The output was:
1
Microsoft (R)-Buildmodul, Version 14.0.25420.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Der Buildvorgang wurde am 18.01.2019 15:09:14 gestartet.
Projekt "C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" auf Knoten "1" (Standardziele).
PrepareForBuild:
Das Verzeichnis "Debug" wird erstellt.
Das Verzeichnis "DebugCompilerIdC.tlog" wird erstellt.
InitializeBuildStatus:
"DebugCompilerIdC.tlogunsuccessfulbuild" wird erstellt, da "AlwaysCreate" angegeben wurde.
ClCompile:
CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\" /Fd"Debugvc140.pdb" /Gd /TC /errorReport:queue CMakeCCompilerId.c
TRACKER : Fehler TRK0005: Fehler beim Suchen von "CL.exe". Das System kann die angegebene Datei nicht finden.


C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj]
Die Erstellung des Projekts "C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" ist abgeschlossen (Standardziele) -- FEHLER.

Fehler beim Buildvorgang.

"C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" (Standardziel) (1) ->
(ClCompile Ziel) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj]

0 Warnung(en)
1 Fehler

Verstrichene Zeit 00:00:00.28


Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler:
Build flags:
Id flags:

The output was:
1
Microsoft (R)-Buildmodul, Version 14.0.25420.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Der Buildvorgang wurde am 18.01.2019 15:09:15 gestartet.
Projekt "C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" auf Knoten "1" (Standardziele).
PrepareForBuild:
Das Verzeichnis "Debug" wird erstellt.
Das Verzeichnis "DebugCompilerIdC.tlog" wird erstellt.
InitializeBuildStatus:
"DebugCompilerIdC.tlogunsuccessfulbuild" wird erstellt, da "AlwaysCreate" angegeben wurde.
ClCompile:
CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\" /Fd"Debugvc140.pdb" /Gd /TC /errorReport:queue CMakeCCompilerId.c
TRACKER : Fehler TRK0005: Fehler beim Suchen von "CL.exe". Das System kann die angegebene Datei nicht finden.


C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj]
Die Erstellung des Projekts "C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" ist abgeschlossen (Standardziele) -- FEHLER.

Fehler beim Buildvorgang.

"C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" (Standardziel) (1) ->
(ClCompile Ziel) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj]

0 Warnung(en)
1 Fehler

Verstrichene Zeit 00:00:00.27


Obviously neither $CC nor $CXX are taken into consideration by CMake, although they exist:



$ echo $CC
c:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.11.25503/bin/Hostx64/x64/cl.exe

mark@zws103 MINGW64 /c/lib
$ echo $CXX
c:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.11.25503/bin/Hostx64/x64/cl.exe


PS: of course there could be some problem with spaces in filenames, but I tried gcc with a no-space path and the result was literally the same.



$ $CC
bash: c:/Program: No such file or directory

mark@zws103 MINGW64 /c/lib
$ "$CC"
Microsoft (R) C/C++-Optimierungscompiler Version 19.11.25508.2 f¦r x64
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Syntax: cl [ Option... ] Dateiname... [ /link Linkeroption... ]









share|improve this question























  • Try not setting CC or CCX when using Visual Studio and see if it fixes the issue. It probably interferes with the normal operation of Visual Studio tools like MSBuild. Normally you don't need to set these variables.

    – Fred
    Jan 18 at 14:23











  • I think that $CC and $CXX are not the correct environment variables. Set $CMAKE_C_COMPILER and $CMAKE_CXX_COMPILER instead.

    – BHawk
    Jan 18 at 15:27











  • @BHawk sorry, doesn't change anything. Same error :(. I deleted the whole tree so that no leftovers in a cache file would cause problems.

    – Vroomfondel
    Jan 18 at 15:34











  • Are you using Visual Studio 2015?

    – BHawk
    Jan 18 at 15:39






  • 1





    You will need to change the line in installOCV.sh to reflect that: CMAKE_CONFIG_GENERATOR="Visual Studio 14 2015 Win64" should be changed to CMAKE_CONFIG_GENERATOR="Visual Studio 15 2017 Win64"

    – BHawk
    Jan 18 at 15:45














0












0








0








I am trying to compile OpenCV from source on Windows 10 because I thought this to be the way to incorporate the surface matching module into the library. I tried to follow the installation instructions here but when I try to execute the installOCV.sh from inside the gitbash like described, it fails halfway when CMake tries to testcompile with the C and C++ compiler. The script output is this:



$ ./installOCV.sh
Already up to date.
Current branch master is up to date.
Already up to date.
Current branch master is up to date.
/c/lib/Build/opencv /c/lib
-- Selecting Windows SDK version to target Windows 10.0.17134.
-- The CXX compiler identification is unknown
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:131 (project):
No CMAKE_CXX_COMPILER could be found.

CMake Error at CMakeLists.txt:131 (project):
No CMAKE_C_COMPILER could be found.

-- Configuring incomplete, errors occurred!
See also "C:/lib/Build/opencv/CMakeFiles/CMakeOutput.log".
See also "C:/lib/Build/opencv/CMakeFiles/CMakeError.log".


and CMakeError.log displays the following (sorry German):



Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler:
Build flags:
Id flags:

The output was:
1
Microsoft (R)-Buildmodul, Version 14.0.25420.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Der Buildvorgang wurde am 18.01.2019 15:09:13 gestartet.
Projekt "C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" auf Knoten "1" (Standardziele).
PrepareForBuild:
Das Verzeichnis "Debug" wird erstellt.
Das Verzeichnis "DebugCompilerIdCXX.tlog" wird erstellt.
InitializeBuildStatus:
"DebugCompilerIdCXX.tlogunsuccessfulbuild" wird erstellt, da "AlwaysCreate" angegeben wurde.
ClCompile:
CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\" /Fd"Debugvc140.pdb" /Gd /TP /errorReport:queue CMakeCXXCompilerId.cpp
TRACKER : Fehler TRK0005: Fehler beim Suchen von "CL.exe". Das System kann die angegebene Datei nicht finden.


C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj]
Die Erstellung des Projekts "C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" ist abgeschlossen (Standardziele) -- FEHLER.

Fehler beim Buildvorgang.

"C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" (Standardziel) (1) ->
(ClCompile Ziel) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj]

0 Warnung(en)
1 Fehler

Verstrichene Zeit 00:00:00.26


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler:
Build flags:
Id flags:

The output was:
1
Microsoft (R)-Buildmodul, Version 14.0.25420.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Der Buildvorgang wurde am 18.01.2019 15:09:14 gestartet.
Projekt "C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" auf Knoten "1" (Standardziele).
PrepareForBuild:
Das Verzeichnis "Debug" wird erstellt.
Das Verzeichnis "DebugCompilerIdCXX.tlog" wird erstellt.
InitializeBuildStatus:
"DebugCompilerIdCXX.tlogunsuccessfulbuild" wird erstellt, da "AlwaysCreate" angegeben wurde.
ClCompile:
CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\" /Fd"Debugvc140.pdb" /Gd /TP /errorReport:queue CMakeCXXCompilerId.cpp
TRACKER : Fehler TRK0005: Fehler beim Suchen von "CL.exe". Das System kann die angegebene Datei nicht finden.


C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj]
Die Erstellung des Projekts "C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" ist abgeschlossen (Standardziele) -- FEHLER.

Fehler beim Buildvorgang.

"C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" (Standardziel) (1) ->
(ClCompile Ziel) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj]

0 Warnung(en)
1 Fehler

Verstrichene Zeit 00:00:00.26


Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler:
Build flags:
Id flags:

The output was:
1
Microsoft (R)-Buildmodul, Version 14.0.25420.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Der Buildvorgang wurde am 18.01.2019 15:09:14 gestartet.
Projekt "C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" auf Knoten "1" (Standardziele).
PrepareForBuild:
Das Verzeichnis "Debug" wird erstellt.
Das Verzeichnis "DebugCompilerIdC.tlog" wird erstellt.
InitializeBuildStatus:
"DebugCompilerIdC.tlogunsuccessfulbuild" wird erstellt, da "AlwaysCreate" angegeben wurde.
ClCompile:
CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\" /Fd"Debugvc140.pdb" /Gd /TC /errorReport:queue CMakeCCompilerId.c
TRACKER : Fehler TRK0005: Fehler beim Suchen von "CL.exe". Das System kann die angegebene Datei nicht finden.


C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj]
Die Erstellung des Projekts "C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" ist abgeschlossen (Standardziele) -- FEHLER.

Fehler beim Buildvorgang.

"C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" (Standardziel) (1) ->
(ClCompile Ziel) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj]

0 Warnung(en)
1 Fehler

Verstrichene Zeit 00:00:00.28


Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler:
Build flags:
Id flags:

The output was:
1
Microsoft (R)-Buildmodul, Version 14.0.25420.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Der Buildvorgang wurde am 18.01.2019 15:09:15 gestartet.
Projekt "C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" auf Knoten "1" (Standardziele).
PrepareForBuild:
Das Verzeichnis "Debug" wird erstellt.
Das Verzeichnis "DebugCompilerIdC.tlog" wird erstellt.
InitializeBuildStatus:
"DebugCompilerIdC.tlogunsuccessfulbuild" wird erstellt, da "AlwaysCreate" angegeben wurde.
ClCompile:
CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\" /Fd"Debugvc140.pdb" /Gd /TC /errorReport:queue CMakeCCompilerId.c
TRACKER : Fehler TRK0005: Fehler beim Suchen von "CL.exe". Das System kann die angegebene Datei nicht finden.


C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj]
Die Erstellung des Projekts "C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" ist abgeschlossen (Standardziele) -- FEHLER.

Fehler beim Buildvorgang.

"C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" (Standardziel) (1) ->
(ClCompile Ziel) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj]

0 Warnung(en)
1 Fehler

Verstrichene Zeit 00:00:00.27


Obviously neither $CC nor $CXX are taken into consideration by CMake, although they exist:



$ echo $CC
c:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.11.25503/bin/Hostx64/x64/cl.exe

mark@zws103 MINGW64 /c/lib
$ echo $CXX
c:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.11.25503/bin/Hostx64/x64/cl.exe


PS: of course there could be some problem with spaces in filenames, but I tried gcc with a no-space path and the result was literally the same.



$ $CC
bash: c:/Program: No such file or directory

mark@zws103 MINGW64 /c/lib
$ "$CC"
Microsoft (R) C/C++-Optimierungscompiler Version 19.11.25508.2 f¦r x64
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Syntax: cl [ Option... ] Dateiname... [ /link Linkeroption... ]









share|improve this question














I am trying to compile OpenCV from source on Windows 10 because I thought this to be the way to incorporate the surface matching module into the library. I tried to follow the installation instructions here but when I try to execute the installOCV.sh from inside the gitbash like described, it fails halfway when CMake tries to testcompile with the C and C++ compiler. The script output is this:



$ ./installOCV.sh
Already up to date.
Current branch master is up to date.
Already up to date.
Current branch master is up to date.
/c/lib/Build/opencv /c/lib
-- Selecting Windows SDK version to target Windows 10.0.17134.
-- The CXX compiler identification is unknown
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:131 (project):
No CMAKE_CXX_COMPILER could be found.

CMake Error at CMakeLists.txt:131 (project):
No CMAKE_C_COMPILER could be found.

-- Configuring incomplete, errors occurred!
See also "C:/lib/Build/opencv/CMakeFiles/CMakeOutput.log".
See also "C:/lib/Build/opencv/CMakeFiles/CMakeError.log".


and CMakeError.log displays the following (sorry German):



Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler:
Build flags:
Id flags:

The output was:
1
Microsoft (R)-Buildmodul, Version 14.0.25420.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Der Buildvorgang wurde am 18.01.2019 15:09:13 gestartet.
Projekt "C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" auf Knoten "1" (Standardziele).
PrepareForBuild:
Das Verzeichnis "Debug" wird erstellt.
Das Verzeichnis "DebugCompilerIdCXX.tlog" wird erstellt.
InitializeBuildStatus:
"DebugCompilerIdCXX.tlogunsuccessfulbuild" wird erstellt, da "AlwaysCreate" angegeben wurde.
ClCompile:
CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\" /Fd"Debugvc140.pdb" /Gd /TP /errorReport:queue CMakeCXXCompilerId.cpp
TRACKER : Fehler TRK0005: Fehler beim Suchen von "CL.exe". Das System kann die angegebene Datei nicht finden.


C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj]
Die Erstellung des Projekts "C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" ist abgeschlossen (Standardziele) -- FEHLER.

Fehler beim Buildvorgang.

"C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" (Standardziel) (1) ->
(ClCompile Ziel) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj]

0 Warnung(en)
1 Fehler

Verstrichene Zeit 00:00:00.26


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler:
Build flags:
Id flags:

The output was:
1
Microsoft (R)-Buildmodul, Version 14.0.25420.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Der Buildvorgang wurde am 18.01.2019 15:09:14 gestartet.
Projekt "C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" auf Knoten "1" (Standardziele).
PrepareForBuild:
Das Verzeichnis "Debug" wird erstellt.
Das Verzeichnis "DebugCompilerIdCXX.tlog" wird erstellt.
InitializeBuildStatus:
"DebugCompilerIdCXX.tlogunsuccessfulbuild" wird erstellt, da "AlwaysCreate" angegeben wurde.
ClCompile:
CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\" /Fd"Debugvc140.pdb" /Gd /TP /errorReport:queue CMakeCXXCompilerId.cpp
TRACKER : Fehler TRK0005: Fehler beim Suchen von "CL.exe". Das System kann die angegebene Datei nicht finden.


C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj]
Die Erstellung des Projekts "C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" ist abgeschlossen (Standardziele) -- FEHLER.

Fehler beim Buildvorgang.

"C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj" (Standardziel) (1) ->
(ClCompile Ziel) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCXXCompilerIdCXX.vcxproj]

0 Warnung(en)
1 Fehler

Verstrichene Zeit 00:00:00.26


Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler:
Build flags:
Id flags:

The output was:
1
Microsoft (R)-Buildmodul, Version 14.0.25420.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Der Buildvorgang wurde am 18.01.2019 15:09:14 gestartet.
Projekt "C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" auf Knoten "1" (Standardziele).
PrepareForBuild:
Das Verzeichnis "Debug" wird erstellt.
Das Verzeichnis "DebugCompilerIdC.tlog" wird erstellt.
InitializeBuildStatus:
"DebugCompilerIdC.tlogunsuccessfulbuild" wird erstellt, da "AlwaysCreate" angegeben wurde.
ClCompile:
CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\" /Fd"Debugvc140.pdb" /Gd /TC /errorReport:queue CMakeCCompilerId.c
TRACKER : Fehler TRK0005: Fehler beim Suchen von "CL.exe". Das System kann die angegebene Datei nicht finden.


C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj]
Die Erstellung des Projekts "C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" ist abgeschlossen (Standardziele) -- FEHLER.

Fehler beim Buildvorgang.

"C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" (Standardziel) (1) ->
(ClCompile Ziel) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj]

0 Warnung(en)
1 Fehler

Verstrichene Zeit 00:00:00.28


Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler:
Build flags:
Id flags:

The output was:
1
Microsoft (R)-Buildmodul, Version 14.0.25420.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Der Buildvorgang wurde am 18.01.2019 15:09:15 gestartet.
Projekt "C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" auf Knoten "1" (Standardziele).
PrepareForBuild:
Das Verzeichnis "Debug" wird erstellt.
Das Verzeichnis "DebugCompilerIdC.tlog" wird erstellt.
InitializeBuildStatus:
"DebugCompilerIdC.tlogunsuccessfulbuild" wird erstellt, da "AlwaysCreate" angegeben wurde.
ClCompile:
CL.exe /c /nologo /W0 /WX- /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\" /Fd"Debugvc140.pdb" /Gd /TC /errorReport:queue CMakeCCompilerId.c
TRACKER : Fehler TRK0005: Fehler beim Suchen von "CL.exe". Das System kann die angegebene Datei nicht finden.


C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj]
Die Erstellung des Projekts "C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" ist abgeschlossen (Standardziele) -- FEHLER.

Fehler beim Buildvorgang.

"C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj" (Standardziel) (1) ->
(ClCompile Ziel) ->
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V140Microsoft.CppCommon.targets(356,5): error MSB6006: "CL.exe" wurde mit dem Code 5 beendet. [C:libBuildopencvCMakeFiles3.13.3CompilerIdCCompilerIdC.vcxproj]

0 Warnung(en)
1 Fehler

Verstrichene Zeit 00:00:00.27


Obviously neither $CC nor $CXX are taken into consideration by CMake, although they exist:



$ echo $CC
c:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.11.25503/bin/Hostx64/x64/cl.exe

mark@zws103 MINGW64 /c/lib
$ echo $CXX
c:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.11.25503/bin/Hostx64/x64/cl.exe


PS: of course there could be some problem with spaces in filenames, but I tried gcc with a no-space path and the result was literally the same.



$ $CC
bash: c:/Program: No such file or directory

mark@zws103 MINGW64 /c/lib
$ "$CC"
Microsoft (R) C/C++-Optimierungscompiler Version 19.11.25508.2 f¦r x64
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Syntax: cl [ Option... ] Dateiname... [ /link Linkeroption... ]






opencv cmake environment-variables






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 18 at 14:13









VroomfondelVroomfondel

1,157719




1,157719













  • Try not setting CC or CCX when using Visual Studio and see if it fixes the issue. It probably interferes with the normal operation of Visual Studio tools like MSBuild. Normally you don't need to set these variables.

    – Fred
    Jan 18 at 14:23











  • I think that $CC and $CXX are not the correct environment variables. Set $CMAKE_C_COMPILER and $CMAKE_CXX_COMPILER instead.

    – BHawk
    Jan 18 at 15:27











  • @BHawk sorry, doesn't change anything. Same error :(. I deleted the whole tree so that no leftovers in a cache file would cause problems.

    – Vroomfondel
    Jan 18 at 15:34











  • Are you using Visual Studio 2015?

    – BHawk
    Jan 18 at 15:39






  • 1





    You will need to change the line in installOCV.sh to reflect that: CMAKE_CONFIG_GENERATOR="Visual Studio 14 2015 Win64" should be changed to CMAKE_CONFIG_GENERATOR="Visual Studio 15 2017 Win64"

    – BHawk
    Jan 18 at 15:45



















  • Try not setting CC or CCX when using Visual Studio and see if it fixes the issue. It probably interferes with the normal operation of Visual Studio tools like MSBuild. Normally you don't need to set these variables.

    – Fred
    Jan 18 at 14:23











  • I think that $CC and $CXX are not the correct environment variables. Set $CMAKE_C_COMPILER and $CMAKE_CXX_COMPILER instead.

    – BHawk
    Jan 18 at 15:27











  • @BHawk sorry, doesn't change anything. Same error :(. I deleted the whole tree so that no leftovers in a cache file would cause problems.

    – Vroomfondel
    Jan 18 at 15:34











  • Are you using Visual Studio 2015?

    – BHawk
    Jan 18 at 15:39






  • 1





    You will need to change the line in installOCV.sh to reflect that: CMAKE_CONFIG_GENERATOR="Visual Studio 14 2015 Win64" should be changed to CMAKE_CONFIG_GENERATOR="Visual Studio 15 2017 Win64"

    – BHawk
    Jan 18 at 15:45

















Try not setting CC or CCX when using Visual Studio and see if it fixes the issue. It probably interferes with the normal operation of Visual Studio tools like MSBuild. Normally you don't need to set these variables.

– Fred
Jan 18 at 14:23





Try not setting CC or CCX when using Visual Studio and see if it fixes the issue. It probably interferes with the normal operation of Visual Studio tools like MSBuild. Normally you don't need to set these variables.

– Fred
Jan 18 at 14:23













I think that $CC and $CXX are not the correct environment variables. Set $CMAKE_C_COMPILER and $CMAKE_CXX_COMPILER instead.

– BHawk
Jan 18 at 15:27





I think that $CC and $CXX are not the correct environment variables. Set $CMAKE_C_COMPILER and $CMAKE_CXX_COMPILER instead.

– BHawk
Jan 18 at 15:27













@BHawk sorry, doesn't change anything. Same error :(. I deleted the whole tree so that no leftovers in a cache file would cause problems.

– Vroomfondel
Jan 18 at 15:34





@BHawk sorry, doesn't change anything. Same error :(. I deleted the whole tree so that no leftovers in a cache file would cause problems.

– Vroomfondel
Jan 18 at 15:34













Are you using Visual Studio 2015?

– BHawk
Jan 18 at 15:39





Are you using Visual Studio 2015?

– BHawk
Jan 18 at 15:39




1




1





You will need to change the line in installOCV.sh to reflect that: CMAKE_CONFIG_GENERATOR="Visual Studio 14 2015 Win64" should be changed to CMAKE_CONFIG_GENERATOR="Visual Studio 15 2017 Win64"

– BHawk
Jan 18 at 15:45





You will need to change the line in installOCV.sh to reflect that: CMAKE_CONFIG_GENERATOR="Visual Studio 14 2015 Win64" should be changed to CMAKE_CONFIG_GENERATOR="Visual Studio 15 2017 Win64"

– BHawk
Jan 18 at 15:45












2 Answers
2






active

oldest

votes


















0














CMake is a two step process. The first step creates a set of makefiles or project files that can be used by the compiler. In this case you want to create MS Visual Studio project files.



The basic CMake commands are:



cmake <path to CMakelists.txt"> -G "<the type of compiler I want to use>" [Lots of other parameter options]
cmake --build <path to project files> [lots of other options]


The first line creates the build files needed by the compiler. The generator flag -G specifies the compiler being used. The project file creation also searches for any needed libraries, etc to ensure that the build will work.



The second line does the actual compiling.



The InstallOCV.sh script just sets up a lot of these params for you but it is essentially doing the above two calls in a slightly more complicated way.






share|improve this answer































    0














    Try and download C and C++ compilers via MinGW.
    The files would be named gcc.exe and g++.exe for C and C++ respectively. Add them to the environment path variable and then execute your shell file.



    I hope this helps!






    share|improve this answer
























    • Thanks, but my question specifically targets an installation with Visual C++ under the hood. I at least wanted to try and go this route because the (big) part of my application which will not be image processing, is deeply rooted in a .NET environment and I am so new to the field that I didn't want a gap between those two parts, for debugging reasons. If this is silly, please tell me.

      – Vroomfondel
      yesterday











    • can you add a picture of the components you've installed in your visual studio?

      – Aprajita Verma
      23 hours ago











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54255778%2fcmake-ignores-cc-and-cxx%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    CMake is a two step process. The first step creates a set of makefiles or project files that can be used by the compiler. In this case you want to create MS Visual Studio project files.



    The basic CMake commands are:



    cmake <path to CMakelists.txt"> -G "<the type of compiler I want to use>" [Lots of other parameter options]
    cmake --build <path to project files> [lots of other options]


    The first line creates the build files needed by the compiler. The generator flag -G specifies the compiler being used. The project file creation also searches for any needed libraries, etc to ensure that the build will work.



    The second line does the actual compiling.



    The InstallOCV.sh script just sets up a lot of these params for you but it is essentially doing the above two calls in a slightly more complicated way.






    share|improve this answer




























      0














      CMake is a two step process. The first step creates a set of makefiles or project files that can be used by the compiler. In this case you want to create MS Visual Studio project files.



      The basic CMake commands are:



      cmake <path to CMakelists.txt"> -G "<the type of compiler I want to use>" [Lots of other parameter options]
      cmake --build <path to project files> [lots of other options]


      The first line creates the build files needed by the compiler. The generator flag -G specifies the compiler being used. The project file creation also searches for any needed libraries, etc to ensure that the build will work.



      The second line does the actual compiling.



      The InstallOCV.sh script just sets up a lot of these params for you but it is essentially doing the above two calls in a slightly more complicated way.






      share|improve this answer


























        0












        0








        0







        CMake is a two step process. The first step creates a set of makefiles or project files that can be used by the compiler. In this case you want to create MS Visual Studio project files.



        The basic CMake commands are:



        cmake <path to CMakelists.txt"> -G "<the type of compiler I want to use>" [Lots of other parameter options]
        cmake --build <path to project files> [lots of other options]


        The first line creates the build files needed by the compiler. The generator flag -G specifies the compiler being used. The project file creation also searches for any needed libraries, etc to ensure that the build will work.



        The second line does the actual compiling.



        The InstallOCV.sh script just sets up a lot of these params for you but it is essentially doing the above two calls in a slightly more complicated way.






        share|improve this answer













        CMake is a two step process. The first step creates a set of makefiles or project files that can be used by the compiler. In this case you want to create MS Visual Studio project files.



        The basic CMake commands are:



        cmake <path to CMakelists.txt"> -G "<the type of compiler I want to use>" [Lots of other parameter options]
        cmake --build <path to project files> [lots of other options]


        The first line creates the build files needed by the compiler. The generator flag -G specifies the compiler being used. The project file creation also searches for any needed libraries, etc to ensure that the build will work.



        The second line does the actual compiling.



        The InstallOCV.sh script just sets up a lot of these params for you but it is essentially doing the above two calls in a slightly more complicated way.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 18 at 16:01









        BHawkBHawk

        1,507917




        1,507917

























            0














            Try and download C and C++ compilers via MinGW.
            The files would be named gcc.exe and g++.exe for C and C++ respectively. Add them to the environment path variable and then execute your shell file.



            I hope this helps!






            share|improve this answer
























            • Thanks, but my question specifically targets an installation with Visual C++ under the hood. I at least wanted to try and go this route because the (big) part of my application which will not be image processing, is deeply rooted in a .NET environment and I am so new to the field that I didn't want a gap between those two parts, for debugging reasons. If this is silly, please tell me.

              – Vroomfondel
              yesterday











            • can you add a picture of the components you've installed in your visual studio?

              – Aprajita Verma
              23 hours ago
















            0














            Try and download C and C++ compilers via MinGW.
            The files would be named gcc.exe and g++.exe for C and C++ respectively. Add them to the environment path variable and then execute your shell file.



            I hope this helps!






            share|improve this answer
























            • Thanks, but my question specifically targets an installation with Visual C++ under the hood. I at least wanted to try and go this route because the (big) part of my application which will not be image processing, is deeply rooted in a .NET environment and I am so new to the field that I didn't want a gap between those two parts, for debugging reasons. If this is silly, please tell me.

              – Vroomfondel
              yesterday











            • can you add a picture of the components you've installed in your visual studio?

              – Aprajita Verma
              23 hours ago














            0












            0








            0







            Try and download C and C++ compilers via MinGW.
            The files would be named gcc.exe and g++.exe for C and C++ respectively. Add them to the environment path variable and then execute your shell file.



            I hope this helps!






            share|improve this answer













            Try and download C and C++ compilers via MinGW.
            The files would be named gcc.exe and g++.exe for C and C++ respectively. Add them to the environment path variable and then execute your shell file.



            I hope this helps!







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered yesterday









            Aprajita VermaAprajita Verma

            764




            764













            • Thanks, but my question specifically targets an installation with Visual C++ under the hood. I at least wanted to try and go this route because the (big) part of my application which will not be image processing, is deeply rooted in a .NET environment and I am so new to the field that I didn't want a gap between those two parts, for debugging reasons. If this is silly, please tell me.

              – Vroomfondel
              yesterday











            • can you add a picture of the components you've installed in your visual studio?

              – Aprajita Verma
              23 hours ago



















            • Thanks, but my question specifically targets an installation with Visual C++ under the hood. I at least wanted to try and go this route because the (big) part of my application which will not be image processing, is deeply rooted in a .NET environment and I am so new to the field that I didn't want a gap between those two parts, for debugging reasons. If this is silly, please tell me.

              – Vroomfondel
              yesterday











            • can you add a picture of the components you've installed in your visual studio?

              – Aprajita Verma
              23 hours ago

















            Thanks, but my question specifically targets an installation with Visual C++ under the hood. I at least wanted to try and go this route because the (big) part of my application which will not be image processing, is deeply rooted in a .NET environment and I am so new to the field that I didn't want a gap between those two parts, for debugging reasons. If this is silly, please tell me.

            – Vroomfondel
            yesterday





            Thanks, but my question specifically targets an installation with Visual C++ under the hood. I at least wanted to try and go this route because the (big) part of my application which will not be image processing, is deeply rooted in a .NET environment and I am so new to the field that I didn't want a gap between those two parts, for debugging reasons. If this is silly, please tell me.

            – Vroomfondel
            yesterday













            can you add a picture of the components you've installed in your visual studio?

            – Aprajita Verma
            23 hours ago





            can you add a picture of the components you've installed in your visual studio?

            – Aprajita Verma
            23 hours ago


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54255778%2fcmake-ignores-cc-and-cxx%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Liquibase includeAll doesn't find base path

            How to use setInterval in EJS file?

            Petrus Granier-Deferre