0

I've been trying to build openCV using CMake, but keep running into errors. I think I have MinGW setup properly.

I'm running the following command in C:\opencv\build\x86\mingw:

cmake -G "MinGW Makefiles" -D CMAKE_CXX_COMPILER=mingw32-g++.exe -D CMAKE-MAKE_PROGRAM=mingw32-make.exe ../../../sources

This gives the following error:

-- The CXX compiler identification is GNU 4.8.1 -- The C compiler identification is GNU 4.8.1 -- Check for working CXX compiler: C:/MinGW/bin/mingw32-g++.exe CMake Error: Generator: execution of make failed. Make command was: "mingw32-make.exe" "cmTryCompileExec1510977625/fast" -- Check for working CXX compiler: C:/MinGW/bin/mingw32-g++.exe -- broken CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.2/Modules/CMakeTestCXXCompiler.cmake:54 (message): The C++ compiler "C:/MinGW/bin/mingw32-g++.exe" is not able to compile a simple test program.

It fails with the following output:

Change Dir: C:/opencv/build/x86/mingw/CMakeFiles/CMakeTmp

Run Build Command: "mingw32-make.exe" "cmTryCompileExec1510977625/fast"

The system cannot find the file specified

Generator: execution of make failed.

I was following the instructions found in berak's response to this question: Not sure how to build OpenCV for MinGW

Please provide some suggestions!

Thanks in advance.

1 Answer 1

1

Actually, it should not be necessary to set your compiler and make specifically. So, calling

$ cmake -G "MinGW Makefiles" ../../../sources

should be enough.

If you really want to specify the compiler, you need to set the environment variables CC and CXX, which CMake respects:

$ export CC=/absolute/path/to/your/mingw32-gcc.exe
$ export CXX=/absolute/path/to/your/mingw32-g++.exe
$ cmake -G "MinGW Makefiles" ../../../sources
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.