Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 776
vkotor Avatar asked Mar 03 '11 09:03

vkotor


2 Answers

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).

like image 190
Rudi Avatar answered Nov 15 '22 08:11

Rudi


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?

like image 35
DLRdave Avatar answered Nov 15 '22 07:11

DLRdave