Ask Your Question
1

Opencv-4 compile error (MinGW 5.3 32)

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

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
2

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

berak gravatar image

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

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

Comments

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 -0600 )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 -0600 )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 -0600 )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 -0600 )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 -0600 )edit

Thank you for feedback :) cheers

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

pleasure ;)

did you find anything new about mingw there ?

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

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 -0600 )edit

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

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

@Filipopl -- where exactly did you change what ?

berak gravatar imageberak ( 2018-11-18 09:15:16 -0600 )edit

all WIN32 instances on _WIN32 in alloc.cpp C:\Users\Filip\Desktop\opencv-master\platforms\android_arm\3rdparty\ade\ade-0.1.1d\sources\ade\source\alloc.cpp my alloc : https://gist.github.com/Filipopl123/8...

Filipopl gravatar imageFilipopl ( 2018-11-18 09:19:33 -0600 )edit

wait ... android_arm ? that's NOT using mingw (or let's rather hope, you're NOT trying to use mingw to compile android stuff...)

berak gravatar imageberak ( 2018-11-18 09:49:44 -0600 )edit
Filipopl gravatar imageFilipopl ( 2018-11-18 09:54:36 -0600 )edit

@Filipopl : try: cmake -DBUILD_opencv_gapi=OFF (you can't use it from java anyway)

and somehow, mentioning blogposts is useless. we need to know, what you did, not someone else ..

berak gravatar imageberak ( 2018-11-18 10:18:10 -0600 )edit

My step:

Browse Source: C:/Users/Filip/Desktop/opencv-maste

Browse Build: C:/Users/Filip/Desktop/opencv-master/platforms/android_arm

add entry:

WITH_IP=off
WITH_PROTOBUF=off
BUILD_SHARED_LIB=off
BUILD_opencv_gapi=off
BUILD_JPEG_TURBO_DISABLE=on
ENABLE_PRECOMPILED_HEDERS=on

configure: MingGW Makefiles Set java paths as in the blog

Configure -> generate

Before building the project ‘add_extra_compiler_option(-Werror=non-virtual-dtor)’ option in ‘<opencv-source>\cmake

\OpenCVCompilerOptions.cmake’ file change to ‘#add_extra_compiler_option(-Werror=non-virtual-dtor)’

Go to <mingw-dir>/msys/1.0 and run ‘msys’ bash file. Navigate to android_arm path and run ‘mingw32-make’ command.

and still this error

Filipopl gravatar imageFilipopl ( 2018-11-18 11:01:16 -0600 )edit

Question Tools

1 follower

Stats

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

Seen: 1,619 times

Last updated: Nov 02 '18