Ask Your Question
0

OpenCV 3.4, build with MinGW 8.1.0

asked 2020-04-26 06:05:52 -0600

nji gravatar image

updated 2020-04-26 15:01:54 -0600

I recently updated my Code::Block version which optional comes with mingw. Also updated updated OpenCV from 3.2.

CMake does fine so far, generating a Code::Block project file. But compiling OpenCV gives this:

    cd /d D:\Guido\Downloads\opencv-3.4.10\build\modules\core && C:\PROGRA~2\CODEBL~1\MinGW\bin\windres.exe -O coff $(RC_DEFINES) $(RC_INCLUDES) $(RC_FLAGS) D:\Guido\Downloads\opencv-3.4.10\build\modules\core\vs_version.rc CMakeFiles\opencv_core.dir\vs_version.rc.obj

gcc: error: long: No such file or directory

C:\PROGRA~2\CODEBL~1\MinGW\bin\windres.exe: preprocessing failed.
mingw32-make.exe[2]: *** [modules\core\CMakeFiles\opencv_core.dir\build.make:2589: modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj] Error 1

I've to admit - I don't have any clue. Where is "long" not recognized etc.?

Any help much appreciated.

CodeBlocks: 20.03, mingw: MinGW-W64 8.1.0, 32/64 bit, SEH, CMake: 3.17.1

edit retag flag offensive close merge delete

Comments

It always makes sense to update one thing at a time, so I would try with the old version of OpenCV first to see if the compiler works ok. If not, you'll know where the problem is and can either fix the compiler prolem or even downgrade MingW to get things working temporarily - CodeBlocks lets you select the compiler separately.

mvuori gravatar imagemvuori ( 2020-04-26 09:23:12 -0600 )edit

Thank you for your hint. But to my experience it's quite the opposite. If I (have to) do a major update of one component, it is usually necessary to update the other components too, as not to have a "queer" combination (with "queer" problems), which is of no use for anyone. However I can get OpenCV 3.2 get through with mingw 8.1 with some minor changes to the code. But it would be nice to have 3.4. get through. Hopefully this thread will lead to a result. The problem above seems (for me as a newby) not too hopeless. :)

nji gravatar imagenji ( 2020-04-26 15:07:56 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-04-27 01:10:39 -0600

berak gravatar image

the windres.exe that comes with your mingw cannot handle spaces in strings like "long long" correctly, and thus tries to treat the second "long" incorrectly as a filename.

you can try set the cmake param

-DOPENCV_ENABLE_ALLOCATOR_STATS=OFF

then re-run cmake && make install

edit flag offensive delete link more

Comments

Maybe it's because of my paranoia... but sometimes I have that suspicion, that the devs build that hurdles only to check if there is someone, and to push newbies like me* onto that steep learning curve ... :-))) ... Thank you (again) berak! This did it. Still there remain questions to me: 1. Is disabling OPENCV_ENABLE_ALLOCATOR_STATS the correct/ complete solution (what's its effect?), or does this only supress the error message? 2. Or would the "correct" solution be to get a more recent windres.exe? (*To my defense I would like to say that the compiler's error message was - as not unusual - not helpful/ misleading (vs_version.rc/ winver.h etc.). But yes, I should have payed more attention to the preceding warnings... which better should be errors in this case?)

nji gravatar imagenji ( 2020-04-27 02:54:09 -0600 )edit

it's a workaround, there is not much support for mingw from the opencv devs.

alternatively, you could set

-DOPENCV_ALLOCATOR_STATS_COUNTER_TYPE="int64"
berak gravatar imageberak ( 2020-04-27 03:11:34 -0600 )edit

Please don't let me die ignorant. Can you please tell me what's the effect of the both workarounds? What's their effects and drawbacks, please. (And yes, I very well know that the wonderful open source project opencv, that is connected to many other wonderful open source projects, relys on building with the M$ spider, and ignores gcc/ mingw. Very smart indeed.)

nji gravatar imagenji ( 2020-04-27 03:23:41 -0600 )edit

I do have to understand ... not only to learn, but to be able to assess if this is a proper solution/ answer to the question. As the warnings of not recognizing long long in ..\sources\3rdparty\protobuf\src\google\protobuf\stubs\common.cc is still there.

nji gravatar imagenji ( 2020-04-27 05:56:54 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-04-26 06:05:52 -0600

Seen: 744 times

Last updated: Apr 27 '20