Attention! This forum will be made read-only by Dec-20. Please migrate to Most of existing active users should've received invitation by e-mail.
Ask Your Question

Opencv-4 compile error (MinGW 5.3 32)

asked 2018-11-02 03:53:58 -0500

pouya.1991 gravatar image

Hi I just tried to compile latest opencv-4 version (beta) but I got following error :

[ 32%] Built target quirc
[ 32%] Building CXX object modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1c/sources/ade/source/alloc.cpp.obj
C:\Opencv\build\3rdparty\ade\ade-0.1.1c\sources\ade\source\alloc.cpp: In function 'void* ade::aligned_alloc(std::size_t, std::size_t)':
C:\Opencv\build\3rdparty\ade\ade-0.1.1c\sources\ade\source\alloc.cpp:31:77: error: 'posix_memalign' was not declared in this scope
     auto res = posix_memalign(&ret, std::max(sizeof(void*), alignment), size);
modules\CMakeFiles\ade.dir\build.make:62: recipe for target 'modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1c/sources/ade/source/alloc.cpp.obj' failed
mingw32-make[2]: *** [modules/CMakeFiles/ade.dir/__/3rdparty/ade/ade-0.1.1c/sources/ade/source/alloc.cpp.obj] Error 1
CMakeFiles\Makefile2:980: recipe for target 'modules/CMakeFiles/ade.dir/all' failed
mingw32-make[1]: *** [modules/CMakeFiles/ade.dir/all] Error 2
Makefile:161: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

Is there any solution to tackle this issue ?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2018-11-02 04:05:13 -0500

berak gravatar image

updated 2018-11-02 04:05:57 -0500

it's a known (mingw specific) issue

either wait for the next ade release (where it's fixed) or replace all 3 WIN32 instances in alloc.cpp with _WIN32

edit flag offensive delete link more


Thank u :) Also I have anther problem: I installed CUDA 10, but when I set WITH_CUDA cmake can't find it, Do you have any clue about this problem ?

pouya.1991 gravatar imagepouya.1991 ( 2018-11-02 04:13:52 -0500 )edit

you can't use CUDA with mingw at all. (it only comes with VS libs)

berak gravatar imageberak ( 2018-11-02 04:34:21 -0500 )edit

btw, don't forget to disable WITH_MSMF in cmake, too ! (mingw can't handle it, incomplete headers)

berak gravatar imageberak ( 2018-11-02 04:36:22 -0500 )edit

really ? :( I've developed a classification program in Qt, now for GPU supported I have to install visual studio and use MSVC as my compiler in Qt platform or I must completely move to visual studio?

pouya.1991 gravatar imagepouya.1991 ( 2018-11-02 04:47:10 -0500 )edit

i've no idea about qt, sorry.

and uhmm, since you already installed the CUDA sdk, look around in there, and see, if you can find any mingw libs ... (i last tried 3 years ago)

berak gravatar imageberak ( 2018-11-02 05:12:35 -0500 )edit

Thank you for feedback :) cheers

pouya.1991 gravatar imagepouya.1991 ( 2018-11-02 07:41:43 -0500 )edit

pleasure ;)

did you find anything new about mingw there ?

berak gravatar imageberak ( 2018-11-02 07:43:54 -0500 )edit

I found that as you mentioned there is no CUDA support for mingw 32, so I'm gonna to use MSVC 64 instead :)

pouya.1991 gravatar imagepouya.1991 ( 2018-11-03 08:12:00 -0500 )edit

I have the same problem but replace WIN32 don't help. how fix it?

Filipopl gravatar imageFilipopl ( 2018-11-18 09:11:15 -0500 )edit

@Filipopl -- where exactly did you change what ?

berak gravatar imageberak ( 2018-11-18 09:15:16 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-11-02 03:53:58 -0500

Seen: 978 times

Last updated: Nov 02 '18