Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Problem with building OpenCV with Cmake in Windows

System information (version)

  • OpenCV => 3.4.2 (clone the latest)
  • Operating System / Platform => Windows 10 64-Bit
  • Compiler => gcc 7.2.0 (minGW 5.3.0)

Configuring and generating with CMake works fine, but when I execute mingw32-make in the folder, it stops and shows the error message below.

[ 36%] Linking CXX shared library ..\..\bin\libopencv_core400.dll CMakeFiles\opencv_core.dir/objects.a: member CMakeFiles\opencv_core.dir/objects.a(vs_version.rc.obj) in archive is not an object collect2.exe: error: ld returned 1 exit status mingw32-make[2]: *** [modules\core\CMakeFiles\opencv_core.dir\build.make:1433: bin/libopencv_core400.dll] Error 1 mingw32-make[1]: *** [CMakeFiles\Makefile2:1694: modules/core/CMakeFiles/opencv_core.dir/all] Error 2 mingw32-make: *** [Makefile:162: all] Error 2

I can't find other issue which shows the same symptom, or at least a clue to solve this. I tried this tutorial either, but the same error occurs.

Problem with building OpenCV with Cmake in Windows

System information (version)

  • OpenCV => 3.4.2 (clone the latest)
  • Operating System / Platform => Windows 10 64-Bit
  • Compiler => gcc 7.2.0 (minGW 5.3.0)

Configuring and generating with CMake works fine, but when I execute mingw32-make in the folder, it stops and shows the error message below.

 [ 36%] Linking CXX shared library ..\..\bin\libopencv_core400.dll
CMakeFiles\opencv_core.dir/objects.a: member CMakeFiles\opencv_core.dir/objects.a(vs_version.rc.obj) in archive is not an object
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [modules\core\CMakeFiles\opencv_core.dir\build.make:1433: bin/libopencv_core400.dll] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:1694: modules/core/CMakeFiles/opencv_core.dir/all] Error 2
mingw32-make: *** [Makefile:162: all] Error 2

I can't find other issue which shows the same symptom, or at least a clue to solve this. I tried this tutorial either, but the same error occurs.

[+EDIT]

The line that causes error is below.

cd /d D:\opencv-build\modules\core && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles\opencv_core.dir\link.txt --verbose=$(VERBOSE)

And I manually tried the command below in modules\core folder and it shows the same error.

cmake -E cmake_link_script CMakeFiles\opencv_core.dir\link.txt

Problem with building OpenCV with Cmake in Windows

System information (version)

  • OpenCV => 3.4.2 (clone the latest)
  • Operating System / Platform => Windows 10 64-Bit
  • Compiler => gcc 7.2.0 (minGW 5.3.0)

Configuring and generating with CMake works fine, but when I execute mingw32-make in the folder, it stops and shows the error message below.

[ 36%] Linking CXX shared library ..\..\bin\libopencv_core400.dll
CMakeFiles\opencv_core.dir/objects.a: member CMakeFiles\opencv_core.dir/objects.a(vs_version.rc.obj) in archive is not an object
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [modules\core\CMakeFiles\opencv_core.dir\build.make:1433: bin/libopencv_core400.dll] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:1694: modules/core/CMakeFiles/opencv_core.dir/all] Error 2
mingw32-make: *** [Makefile:162: all] Error 2

I can't find other issue which shows the same symptom, or at least a clue to solve this. I tried this tutorial either, but the same error occurs.

[+EDIT]

The line that causes error is below.

cd /d D:\opencv-build\modules\core && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles\opencv_core.dir\link.txt --verbose=$(VERBOSE)

And I manually tried the command below in modules\core folder and it shows the same error.

cmake -E cmake_link_script CMakeFiles\opencv_core.dir\link.txt

[+EDIT2]

I successfully built it using OpenCV 3.2.0. I checked that 3.3.0 >= shows the error above.