Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Problems Building/Compiling OpenCV 3.0

Hello all,

I downloaded OpenCV to my laptop earlier today in hopes of using it. I previously had v2.4.8 on my desktop and the whole 'no more prebuilt binaries for MinGW' has been causing me grief all day.

The whole problem seems to be CMake. I cannot get it to build/generate the binaries properly.

I tried following the instructions from this blog: OpenCV Install on Windows With Code::Blocks and minGW

The whole process falls apart at the CMake section. So I use the CMakeLists.txt in the opencv\sources since there is none in the opencv folder. I first get these errors:

CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeMinGWFindMake.cmake:22 (message):
  sh.exe was found in your PATH, here:

  C:/MinGW/msys/1.0/bin/sh.exe

  For MinGW make to work correctly sh.exe must NOT be in your path.

  Run cmake from a shell that does not have sh.exe in your PATH.

  If you want to use a UNIX shell, then use MSYS Makefiles.

Call Stack (most recent call first):
  CMakeLists.txt:88 (project)


CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file: C:/opencv/build_mingw/CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file: C:/opencv/build_mingw/CMakeFiles/2.8.12.2/CMakeCCompiler.cmake
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
Configuring incomplete, errors occurred!

So I click configure and generate anyways, then cd into the build folder and run mingw32-make and the build process fails at [34%] with the following:

C:\opencv\sources\modules\core\src\system.cpp: In function 'BOOL cv::DllMain(HINSTANCE, DWORD, LPVOID)':
C:\opencv\sources\modules\core\src\system.cpp:1013:13: warning: no previous declaration for 'BOOL cv::DllMain(HINSTANCE, DWORD, LPVOID)' [-Wmissing-declarations]
 BOOL WINAPI DllMain(HINSTANCE, DWORD fdwReason, LPVOID lpReserved)
             ^
[ 34%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/tables.cpp.obj
[ 34%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/types.cpp.obj
[ 34%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/umatrix.cpp.obj
[ 34%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/opencl_kernels_core.cpp.obj
Linking CXX shared library ..\..\bin\libopencv_core300.dll
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lRunTmChk
collect2.exe: error: ld returned 1 exit status
modules\core\CMakeFiles\opencv_core.dir\build.make:1236: recipe for target 'bin/libopencv_core300.dll' failed
mingw32-make[2]: *** [bin/libopencv_core300.dll] Error 1
CMakeFiles\Makefile2:1485: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed
mingw32-make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

So I am unsure were the problem is, I suspect CMake. I just installed it but perhaps I didn't set up my variables correctly, although this command runs from the command prompt:

cmake -G "MinGW Makefiles" -D CMAKE_CXX_COMPILER=mingw32-g++.exe -D CMAKE_MAKE_PROGRAM=mingw32-make.exe ..\sources

Incase you didn't read the link, I am using Windows 8.1 and MinGW. I believe I have MinGW setup correctly as I am able to use CodeBlocks to build a C++ 'helloworld' program and am able to compile C/C++ programs with Notepad++ using MinGW.

I've tried disabling IPP.

Not sure where to go from here, any help is appreciated.

Thanks in advance.

click to hide/show revision 2
retagged

updated 2015-06-11 02:05:05 -0600

berak gravatar image

Problems Building/Compiling OpenCV 3.0

Hello all,

I downloaded OpenCV to my laptop earlier today in hopes of using it. I previously had v2.4.8 on my desktop and the whole 'no more prebuilt binaries for MinGW' has been causing me grief all day.

The whole problem seems to be CMake. I cannot get it to build/generate the binaries properly.

I tried following the instructions from this blog: OpenCV Install on Windows With Code::Blocks and minGW

The whole process falls apart at the CMake section. So I use the CMakeLists.txt in the opencv\sources since there is none in the opencv folder. I first get these errors:

CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeMinGWFindMake.cmake:22 (message):
  sh.exe was found in your PATH, here:

  C:/MinGW/msys/1.0/bin/sh.exe

  For MinGW make to work correctly sh.exe must NOT be in your path.

  Run cmake from a shell that does not have sh.exe in your PATH.

  If you want to use a UNIX shell, then use MSYS Makefiles.

Call Stack (most recent call first):
  CMakeLists.txt:88 (project)


CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file: C:/opencv/build_mingw/CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file: C:/opencv/build_mingw/CMakeFiles/2.8.12.2/CMakeCCompiler.cmake
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
Configuring incomplete, errors occurred!

So I click configure and generate anyways, then cd into the build folder and run mingw32-make and the build process fails at [34%] with the following:

C:\opencv\sources\modules\core\src\system.cpp: In function 'BOOL cv::DllMain(HINSTANCE, DWORD, LPVOID)':
C:\opencv\sources\modules\core\src\system.cpp:1013:13: warning: no previous declaration for 'BOOL cv::DllMain(HINSTANCE, DWORD, LPVOID)' [-Wmissing-declarations]
 BOOL WINAPI DllMain(HINSTANCE, DWORD fdwReason, LPVOID lpReserved)
             ^
[ 34%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/tables.cpp.obj
[ 34%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/types.cpp.obj
[ 34%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/umatrix.cpp.obj
[ 34%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/opencl_kernels_core.cpp.obj
Linking CXX shared library ..\..\bin\libopencv_core300.dll
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lRunTmChk
collect2.exe: error: ld returned 1 exit status
modules\core\CMakeFiles\opencv_core.dir\build.make:1236: recipe for target 'bin/libopencv_core300.dll' failed
mingw32-make[2]: *** [bin/libopencv_core300.dll] Error 1
CMakeFiles\Makefile2:1485: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed
mingw32-make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

So I am unsure were the problem is, I suspect CMake. I just installed it but perhaps I didn't set up my variables correctly, although this command runs from the command prompt:

cmake -G "MinGW Makefiles" -D CMAKE_CXX_COMPILER=mingw32-g++.exe -D CMAKE_MAKE_PROGRAM=mingw32-make.exe ..\sources

Incase you didn't read the link, I am using Windows 8.1 and MinGW. I believe I have MinGW setup correctly as I am able to use CodeBlocks to build a C++ 'helloworld' program and am able to compile C/C++ programs with Notepad++ using MinGW.

I've tried disabling IPP.

Not sure where to go from here, any help is appreciated.

Thanks in advance.