Set Clion on Windows 10 - clion

I was configuring Clion by following a guide here on StackOverflow, but I have a problem. The section about make, C compiler, and C++ compiler have some problems, but I don't understand what I should do.
Notice the "Test CMake run finished with error" message. When I click on "more...", I see this:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Warning at /cygdrive/c/Users/SpeedHunter/.CLion2018.1/system/cygwin_cmake/share/cmake-3.10.3/Modules/Platform/CYGWIN.cmake:15 (message):
CMake no longer defines WIN32 on Cygwin!
(1) If you are just trying to build this project, ignore this warning or
quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32=0 in your environment or in
the CMake cache. If later configuration or build errors occur then this
project may have been written under the assumption that Cygwin is WIN32.
In that case, set CMAKE_LEGACY_CYGWIN_WIN32=1 instead.
(2) If you are developing this project, add the line
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
at the top of your top-level CMakeLists.txt file or set the minimum
required version of CMake to 2.8.4 or higher. Then teach your project to
build on Cygwin without WIN32.
Call Stack (most recent call first):
/cygdrive/c/Users/SpeedHunter/.CLion2018.1/system/cygwin_cmake/share/cmake-3.10.3/Modules/CMakeSystemSpecificInformation.cmake:26 (include)
CMakeLists.txt:1 (project)
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- broken
CMake Error at /cygdrive/c/Users/SpeedHunter/.CLion2018.1/system/cygwin_cmake/share/cmake-3.10.3/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"/usr/bin/cc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /cygdrive/c/Users/SpeedHunter/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make.exe" "cmTC_4ca12/fast"
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:1 (project)
-- Configuring incomplete, errors occurred!
See also "/cygdrive/c/Users/SpeedHunter/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeOutput.log".
See also "/cygdrive/c/Users/SpeedHunter/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeError.log".
Error code: 1
What should I do?

Related

cmake can't find visual studio When using Ninja although it is installed and cygwin also installed

i have cygwin in path and visual studio also
i like to build VS project for "Visual Studio 16 2019" host=x64 as this is what is installed .
i project is using Ninja and have to generate the project like this :
cmake -G "Ninja" ..
CMake Deprecation Warning at CMakeLists.txt:16 (cmake_policy):
The OLD behavior for policy CMP0046 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
-- The C compiler identification is unknown
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: C:/cygwin64/bin/cc
-- Check for working C compiler: C:/cygwin64/bin/cc -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"C:/cygwin64/bin/cc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Dev/my/a/build2/CMakeFiles/CMakeTmp
Run Build Command(s):C:/PROGRA~2/MICROS~1/2019/COMMUN~1/Common7/IDE/COMMON~1/MICROS~1/CMake/Ninja/ninja.exe cmTC_19d3d && ninja: fatal: CreateProcess: Access is denied.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:31 (project)
-- Configuring incomplete, errors occurred!

Caffe Build Error in Windows 10

I'm trying to build Caffe in Windows 10 following instructions here. I have installed all the prerequisites and dependencies. But I'm getting following error.
-- The C compiler identification is unknown
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-
3.9/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "C:/MinGW/bin/gcc.exe" is not able to compile a simple test
program.
It fails with the following output:
Change Dir: C:/Caffe/caffe/build/CMakeFiles/CMakeTmp
Run Build Command:"C:/Ninja/ninja.exe" "cmTC_6595e"
[1/2] Building C object CMakeFiles\cmTC_6595e.dir\testCCompiler.c.obj
FAILED: CMakeFiles/cmTC_6595e.dir/testCCompiler.c.obj
C:\MinGW\bin\gcc.exe -o CMakeFiles\cmTC_6595e.dir\testCCompiler.c.obj -c
testCCompiler.c
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:18 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Caffe/caffe/build/CMakeFiles/CMakeOutput.log".
See also "C:/Caffe/caffe/build/CMakeFiles/CMakeError.log".
ERROR: Configure failed
Caffe Build Error
I searched for a solution and tried different things but nothing could solve the problem. Any help with this regard is highly appreciated.
Thanks in advance!
I finally figured it out. It was a problem with the C Compiler in my computer - gcc. I reinstalled the compiler and following two lines to CMakeList.txt file according to this solution,
set(CMAKE_C_COMPILER "C:/MinGW/bin/gcc.exe")
set(CMAKE_CXX_COMPILER "C:/MinGW/bin/g++.exe")

using cmake with mingw-w64 error compiling test program

I'm trying to do a simple compilation with mingw-w64 and cmake. But for some reason I can't. It fails verifying if gcc can compile a C program which is weird. Any ideas?
Thanks
Paulo
C:\work\opencv\myown\hello>cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CC_COMPILER=gcc
-- The C compiler identification is GNU 5.3.0
-- The CXX compiler identification is GNU 5.3.0
-- Check for working C compiler: C:/Program Files/mingw-w64/x86_64-5.3.0-win32-seh-rt_v4-rev0/mingw64/bin/gcc.exe
CMake Error: Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_8ce25\fast"
-- Check for working C compiler: C:/Program Files/mingw-w64/x86_64-5.3.0-win32-seh-rt_v4-rev0/mingw64/bin/gcc.exe -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "C:/Program
Files/mingw-w64/x86_64-5.3.0-win32-seh-rt_v4-rev0/mingw64/bin/gcc.exe" is
not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/work/opencv/myown/hello/CMakeFiles/CMakeTmp
Run Build Command:"nmake" "/NOLOGO" "cmTC_8ce25\fast"
Generator: execution of make failed. Make command was: "nmake" "/NOLOGO"
"cmTC_8ce25\fast"
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:7 (project)
-- Configuring incomplete, errors occurred!
See also "C:/work/opencv/myown/hello/CMakeFiles/CMakeOutput.log".
See also "C:/work/opencv/myown/hello/CMakeFiles/CMakeError.log".
Is nmake available in your PATH?
You can provide another make command using CMAKE_MAKE_PROGRAM, like for instance:
cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CC_COMPILER=gcc -DCMAKE_MAKE_PROGRAM=mingw32-make

CMake with MinGW and Eclipse CDT

I'm trying to compile OpenCV with Cmake on Windows 7 (64-bit). It is to be used with Eclipse and CDT, for which I read somewhere that youhave to specify Unix Makefiles regardless of the compiler.
Now, given that I have cygwin as well (for Android NDK stuff), I first tried using its compilers, and I successfully configure CMake and generate makefiles, but only get to 63% of compiling, when OpenCV spits an error (about ffmpeg and HMODULE). So I switched to MinGW (HelloWorld with it was also a pain, I had to specify a full path to MinGW g++ regardless of the PATH variable setting), but now I cannot even configure CMake. I get the following error:
The C compiler identification is GNU
The CXX compiler identification is GNU
CMake Error: your RC compiler: "CMAKE_RC_COMPILER-NOTFOUND" was not found. Please set CMAKE_RC_COMPILER to a valid compiler path or name.
Check for working C compiler: C:/MinGW/bin/gcc.exe
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeRCInformation.cmake:22 (GET_FILENAME_COMPONENT):
get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-GNU.cmake:59 (enable_language)
C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-GNU-C.cmake:1 (include)
C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeCInformation.cmake:56 (INCLUDE)
CMakeLists.txt:2 (PROJECT)
CMake Error: CMAKE_RC_COMPILER not set, after EnableLanguage
CMake Error: Internal CMake error, TryCompile configure of cmake failed
Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
The C compiler "C:/MinGW/bin/gcc.exe" is not able to compile a simple test program.
It fails with the following output:
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:47 (project)
Configuring incomplete, errors occurred!
If anyone has any idea what might be a problem (conflict with cygwin shell?), I'd appreciate any input. Thanks in advance!
We ran into the same problem with the "Unix Makefiles" Generator. We solved it by using the "MSYS Makefiles" generator (Msys is a shell environment around MinGW, like [a very small] cygwin).
This error message text:
CMake Error: your RC compiler: "CMAKE_RC_COMPILER-NOTFOUND" was not found.
Please set CMAKE_RC_COMPILER to a valid compiler path or name.
indicates that "windres" (for mingw and cygwin gcc-based build trees) is not in the PATH.
windres support, to compile Windows resource (*.rc) files was recently added in CMake 2.8.4. Perhaps windres is not available in your MinGW environment?

cmake doesn't work in windows XP

I'm new with cmake,just installed it and following this article:
http://www.cs.swarthmore.edu/~adanner/tips/cmake.php
D:\Works\c\cmake\build>cmake ..
-- Building for: NMake Makefiles
CMake Warning at CMakeLists.txt:2 (project):
To use the NMake generator, cmake must be run from a shell that can use the
compiler cl from the command line. This environment does not contain
INCLUDE, LIB, or LIBPATH, and these must be set for the cl compiler to
work.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Warning at D:/Tools/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-cl.cmake:32 (ENABLE_LANGUAGE):
To use the NMake generator, cmake must be run from a shell that can use the
compiler cl from the command line. This environment does not contain
INCLUDE, LIB, or LIBPATH, and these must be set for the cl compiler to
work.
Call Stack (most recent call first):
D:/Tools/CMake 2.8/share/cmake-2.8/Modules/CMakeCInformation.cmake:58 (INCLUDE)
CMakeLists.txt:2 (project)
CMake Error: your RC compiler: "CMAKE_RC_COMPILER-NOTFOUND" was not found. Please set CMAKE_RC_COMPILER to a valid compiler path or name.
-- Check for CL compiler version
-- Check for CL compiler version - failed
-- Check if this is a free VC compiler
-- Check if this is a free VC compiler - yes
-- Using FREE VC TOOLS, NO DEBUG available
-- Check for working C compiler: cl
CMake Warning at CMakeLists.txt:2 (PROJECT):
To use the NMake generator, cmake must be run from a shell that can use the
compiler cl from the command line. This environment does not contain
INCLUDE, LIB, or LIBPATH, and these must be set for the cl compiler to
work.
CMake Warning at D:/Tools/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-cl.cmake:32 (ENABLE_LANGUAGE):
To use the NMake generator, cmake must be run from a shell that can use the
compiler cl from the command line. This environment does not contain
INCLUDE, LIB, or LIBPATH, and these must be set for the cl compiler to
work.
Call Stack (most recent call first):
D:/Tools/CMake 2.8/share/cmake-2.8/Modules/CMakeCInformation.cmake:58 (INCLUDE)
CMakeLists.txt:2 (PROJECT)
CMake Error at D:/Tools/CMake 2.8/share/cmake-2.8/Modules/CMakeRCInformation.cmake:22 (GET_FILENAME_COMPONENT):
get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
D:/Tools/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-cl.cmake:32 (ENABLE_LANGUAGE)
D:/Tools/CMake 2.8/share/cmake-2.8/Modules/CMakeCInformation.cmake:58 (INCLUDE)
CMakeLists.txt:2 (PROJECT)
CMake Error: CMAKE_RC_COMPILER not set, after EnableLanguage
CMake Error: your C compiler: "cl" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name.
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Check for working C compiler: cl -- broken
CMake Error at D:/Tools/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:
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
CMake Error: your C compiler: "cl" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name.
CMake Error: your CXX compiler: "cl" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
-- Configuring incomplete, errors occurred!
What are the complete requirement to use cmake successfully in windows XP?I've already installed Visual Studio under D:\Tools\Microsoft Visual Studio 9.0
First of all, I have to confess that I don't know cmake.
To use the NMake generator, cmake
must be run from a shell that can use
the compiler cl from the command
line. This environment does not
contain INCLUDE, LIB, or LIBPATH,
and these must be set for the cl
compiler to work.
The error above means that the proper locations to your C/C++ compiler's headers and libraries could not be found by cmake.
Instead of running cmake from the Command Prompt, try running cmake from the Visual Studio 2008 Command Prompt. You can find it under Start > Programs > Microsoft Visual Studio 2008 > Visual Studio Tools) or vcvarsall.bat in the folder *Microsoft Visual Studio 9.0\VC*. The visual Studio 2008 Command Prompt should set all these environment variables for you automatically so that cmake knows where to find the necessary files that it needs.
The Command Prompt will start in your Visual Studio folder, so you'll have to type the following commands to switch to your source folder and start cmake.
D:
cd D:\Works\c\cmake\build>
cmake
I hope this helps you.
I had similar issues on Win7, and was getting the same error - The C compiler "cl.exe" is not able to compile a simple test program.
The solution that worked for me :
On Windows Donot run cmake on the cygwin terminal.
Run it from the command prompt, AND also ensure that you have admin rights, In windows 7 you can start command prompt as administrator by going to Start->All programs->Accessories-> (Right Click on Command Prompt) and Select "Run as administrator"
Then run 'cmake <your source>' Worked like a charm for me.

Resources