Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

opencv 4.3 compiling problems on windows

am trying to build opencv 4.3 using

OpenCV => 4.3

Operating system : windows 10 64 bit

Compiler : Mingw-64 v8.1.0

C:\opencv\build>gcc -v

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-8.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-posix-seh-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/lib -L/c/mingw810/prerequisites/x86_64-zlib-static/lib -L/c/mingw810/prerequisites/x86_64-w64-mingw32-static/lib '
Thread model: posix
gcc version 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)

Getting error related to rc object

[ 22%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/matmul.avx2.cpp.obj
[ 22%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/mean.avx2.cpp.obj
[ 22%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/merge.avx2.cpp.obj
[ 23%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/split.avx2.cpp.obj
[ 23%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/sum.avx2.cpp.obj
[ 23%] Building RC object modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj
gcc: error: long: No such file or directory
C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\windres.exe: preprocessing failed.
mingw32-make[2]: *** [modules\core\CMakeFiles\opencv_core.dir\build.make:2564: modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj] Error 1
mingw32-make[2]: *** Waiting for unfinished jobs....
mingw32-make[1]: *** [CMakeFiles\Makefile2:2701: modules/core/CMakeFiles/opencv_core.dir/all] Error 2
mingw32-make: *** [Makefile:162: all] Error 2

Steps to reproduce

  • install Cmake 3.8.2 or latest ( i tried latest and 3.8.2 as some users on forums said that they downgraded to 3.8.2 and then rc.object error resolved ) but not worked for me
  • download and install mingw-64 to C:\mingw-w64 : https://netix.dl.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe
  • set system path to : C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin
  • open CMD
  • cd C:\opencv\source
  • git clone https://github.com/opencv/opencv.git
  • git clone https://github.com/opencv/opencv_contrib.git
  • open cmake gui
  • set source and build directories : C:\opencv\build
  • click configure
  • search java , uncheck BUILD_JAVA
  • search python uncheck BUILD_PYTHON
  • search openexr , uncheck BUILD_OPENEXR
  • search WITH_IPP , uncheck WITH_IPP
  • search ENABLE_PRECOMPILED_HEADERS , uncheck it
  • search WITH_OPENGL , check it
  • search free and check OPENCV_ENABLE_NONFREE
  • set OPENCV_EXTRA_MODULES_PATH to C:\opencv\source\opencv-contrib\modules

+click configure , wait till its completed +click generate
+ open CMD with admin rights + cd C:\opencv\build + mingw32-make -j 8 + you will see error ?