Ask Your Question

Error during opencv 3.3.0 source compilation

asked 2017-10-12 01:10:09 -0600

SpacePirate gravatar image


So I got the sources from :

installed MinGW in c:\MinGW and rebooted (latest version)

I then installed Cmake from (latest version)

I extracted the sources in c:\opencv_opencv3.3.0-sources

I runned cmakeGui

I gave it c:\opencv<_opencv3.3.0-sources as source dir and c:\opencv<_opencv3.3.0-build as build dir

I hitted 'configure', selected 'MinGW makefile' and let it run util it showed me checkboxes in red

I checked the C examples

I hitted 'configure' again and let it run, now all the line turned white

I hitted 'generate'

Then I went in c:\opencv_opencv3.3.0-build and opened a command line an typed : 'mingw32-make --debug'

and a 28% I get an error :

[ 28%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/mathfuncs_core.avx2.cpp.obj
    Successfully remade target file 'modules/core/CMakeFiles/opencv_core.dir/mathfuncs_core.avx2.cpp.obj'.
     File 'modules/core/CMakeFiles/opencv_core.dir/stat.avx2.cpp.obj' does not exist.
    Must remake target 'modules/core/CMakeFiles/opencv_core.dir/stat.avx2.cpp.obj'.
[ 28%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/stat.avx2.cpp.obj
    Successfully remade target file 'modules/core/CMakeFiles/opencv_core.dir/stat.avx2.cpp.obj'.
     File 'modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj' does not exist.
    Must remake target 'modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj'.
[ 28%] Building RC object modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj
C:\MinGW\bin\windres.exe: invalid option -- W
Usage: C:\MinGW\bin\windres.exe [option(s)] [input-file] [output-file]
 The options are:
  -i --input=<file>            Name input file
  -o --output=<file>           Name output file
  -J --input-format=<format>   Specify input format
  -O --output-format=<format>  Specify output format
  -F --target=<target>         Specify COFF target
     --preprocessor=<program>  Program to use to preprocess rc file
     --preprocessor-arg=<arg>  Additional preprocessor argument
  -I --include-dir=<dir>       Include directory when preprocessing rc file
  -D --define <sym>[=<val>]    Define SYM when preprocessing rc file
  -U --undefine <sym>          Undefine SYM when preprocessing rc file
  -v --verbose                 Verbose - tells you what it's doing
  -c --codepage=<codepage>     Specify default codepage
  -l --language=<val>          Set language when reading rc file
     --use-temp-file           Use a temporary file instead of popen to read
                               the preprocessor output
     --no-use-temp-file        Use popen (default)
  -r                           Ignored for compatibility with rc

  @<file>                      Read options from <file>
  -h --help                    Print this help message
  -V --version                 Print version information
FORMAT is one of rc, res, or coff, and is deduced from the file name
extension if not specified.  A single file name is an input file.
No input-file is stdin, default rc.  No output-file is stdout, default rc.
C:\MinGW\bin\windres.exe: supported targets: pe-i386 pei-i386 elf32-i386 elf32-iamcu elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex
modules\core\CMakeFiles\opencv_core.dir\build.make:1641: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj' failed
mingw32-make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj] Error 1
CMakeFiles\Makefile2:1550: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed
mingw32-make[1]: *** [modules ...
edit retag flag offensive close merge delete


it might already work, if you disable precompiled headers in cmake, try that first (and clean build folder) !

(but again, there will be more errors. opencv stopped supporting mingw a long time ago)

berak gravatar imageberak ( 2017-10-12 02:00:52 -0600 )edit

@berak@mshabunin "opencv stopped supporting mingw a long time ago" but i think it's a problem because it is a free compiler for windows (even if VS can be free download sometime ).

LBerger gravatar imageLBerger ( 2017-10-12 03:12:41 -0600 )edit

i never said, i liked that decision. (and i have to use mingw, too.)

last comments i've seen wrt. were like: oh, we're not going to do the work required, but if you do that, we'll happily accept patches/pr's . it's a matter of focus, i guess.

berak gravatar imageberak ( 2017-10-12 03:17:43 -0600 )edit

@berak I said it's only a problem (like you wrote you never said you liked it). Is it possible to solve this problem with the help opencv team ? example @mshabunin some peoples gives a full method to build a mingw64 release and opencv team make it available on github.

LBerger gravatar imageLBerger ( 2017-10-12 04:01:20 -0600 )edit

let's try to to write something up, maybe we can get it into the tutorials ?

berak gravatar imageberak ( 2017-10-12 04:13:36 -0600 )edit

@SpacePirate If you want to stick with mingw32-make, see:

You should be able to build OpenCV 3.3 release without precompiled headers and by tweaking one file.

Eduardo gravatar imageEduardo ( 2017-10-12 07:13:40 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-10-12 05:03:33 -0600

mshabunin gravatar image

There is a newer version of mingw - mingw-w64, which is actively developed. mingw32- is obsolete version, last stable release was in October 4, 2013. You can read more about it in Wikipedia:

I just tried to crosscompile the latest master branch revision of OpenCV using mingw-w64 5.3.1 toolchain provided by Ubuntu - it resulted with success. Most probably it can be built in Windows too.

I'd recommend using the Visual Studio for compilation as it is the most tested method. If you wish to use mingw-w64, I'd recommend to take a look at the QtCreator, because it is a great IDE which supports both cmake and mingw with several clicks.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-10-12 01:10:09 -0600

Seen: 814 times

Last updated: Oct 12 '17