Sorry, this content is no longer available

Ask Your Question
1

Building OpenCV with MinGW (gcc 7.1.0 and cmake 3.9.0)-> windres.exe: unknown option -- W

asked Jul 23 '17

DJUego gravatar image

Hi!

Windows 10 x64

I try to build (default options) the current opencv master (2017/07/23) in MinGW (Mingw-builds, msys2) and i get;

> make
[  2%] Built target zlib
[  5%] Built target libtiff
[  8%] Built target libjpeg
[ 16%] Built target libwebp
[ 19%] Built target libjasper
[ 20%] Built target libpng
[ 25%] Built target IlmImf
[ 31%] Built target libprotobuf
[ 32%] Built target opencv_core_pch_dephelp
[ 32%] Built target pch_Generate_opencv_core
[ 32%] Building RC object modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj
v:\MinGW-Builds\mingw64\bin\windres.exe: unknown option -- W
Usage: v:\MinGW-Builds\mingw64\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.
v:\MinGW-Builds\mingw64\bin\windres.exe: supported targets: pe-x86-64 pei-x86-64 pe-bigobj-x86-64 elf64-x86-64 elf64-l1om elf64-k1om pe-i386 pei-i386 elf32-i386 elf32-iamcu elf64-little elf64-big elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex
modules/core/CMakeFiles/opencv_core.dir/build.make:1642: recipe for target `modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj' failed
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj] Error 1
CMakeFiles/Makefile2:1512: recipe for target `modules/core/CMakeFiles/opencv_core.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
Makefile:162: recipe for target `all' failed
make: *** [all] Error 2

Any idea? Thanks in advance!

DJuego

Preview: (hide)

Comments

It was good in 3.2.0... go back to 3.2.0 and make an issue@berak can you compile opencv 3.3.0-rc using mingw?

LBerger gravatar imageLBerger (Jul 23 '17)edit

yes, but using cmake 3.5 here

berak gravatar imageberak (Jul 24 '17)edit

any other solutions? I can't build with Cmake 3.5, 3.9, 2.8.7 or others. Supposedly it works with 2.8.1 but some modules I want to build require 2.8.7 or higher. I have no idea what to edit to overcome this problem/

edit. Ok it seems that disabling precompiled headers helps (mingw+cmake 3.5)

p310 gravatar imagep310 (Jul 25 '17)edit

2 answers

Sort by » oldest newest most voted
1

answered Aug 16 '17

larryluo619 gravatar image

updated Aug 16 '17

I also had this issue when I compiled OpenCV3.3 source code for Qt. Then I found the hint here(https://wiki.qt.io/How_to_setup_Qt_and_openCV_on_Windows).

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ If you have the following error : ... windres.exe: unknown option -- W ...

try this : in cmake uncheck ENABLE_PRECOMPILED_HEADERS

If, in the file opencv/sources/modules/videoio/src/cap_dshow.cpp, you have the following error : 'sprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA' was not declared in this scope ...

try this :put the following line: #define NO_DSHOW_STRSAFE, before the line : #include "DShow.h"

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Following above hints, it's OK at last.

My envirement: Whindows 7/10 64bit, Cmake 3.9.1, Qt5.9.1

Preview: (hide)

Comments

Hello, thanks, you save my day and most of my night. As DJUego asks, can you explain what could be the "consequences (collateral effects) of disabling precompiled headers"?

virgiled gravatar imagevirgiled (Sep 21 '17)edit

@virgiled and @DJUego For precompiled headers see here. The build process will be just slower without precompiled headers.

Eduardo gravatar imageEduardo (Oct 10 '17)edit

ok, I see; tx very much for this precision @Eduardo.

virgiled gravatar imagevirgiled (Oct 10 '17)edit
0

answered Jul 26 '17

DJUego gravatar image

Hi! Thank you for your answers, guys. I can confirm that disabling precompiled headers (in CMake) works! Thank you for the hint, p310!! I am using cmake 3.9.0.

I have other problems with building but i think they are not related with this. I will open a new question about them. In a related note, What are the consequences (collateral effects) of disabling precompiled headers? Thanks in advance!

DJuego

Preview: (hide)

Question Tools

2 followers

Stats

Asked: Jul 23 '17

Seen: 9,500 times

Last updated: Aug 16 '17