Ask Your Question

unable to complete 'make -j7' with opencv_contrib modules

asked 2018-07-27 08:11:08 -0500

LuMoVo gravatar image

Cmake can not compile extra modules from opencv_contrib. I am following theese instructions . Sorry for my length of my Ask, but giving more info about my Issues. This is example of my CMake options:

-DOPENCV_EXTRA_MODULES_PATH=/home/luke/cv/opencv_contrib/modules  ..

Till here it is fine. Configured. Generated (maybe with basicly some warnings etc.) :

-- Configuring done
-- Generating done
-- Build files have been written to: /home/luke/cv/opencv-3.4.0/build

But when I enter in build directory "make -j7"

Scanning dependencies of target opencv_core_pch_dephelp
[  0%] Built target gen-pkgconfig
[  0%] Building CXX object 3rdparty/openexr/CMakeFiles/IlmImf.dir/Half/half.cpp.o

...(HERE will comes my ISSUES)

then during a procedure, on the first module from opencv_contrib I will EVERYTIME get many of theese same couples of errors:

Scanning dependencies of target opencv_test_reg_pch_dephelp
[ 12%] Building CXX object modules/reg/CMakeFiles/opencv_test_reg_pch_dephelp.dir/opencv_test_reg_pch_dephelp.cxx.o
[ 12%] Building CXX object 3rdparty/openexr/CMakeFiles/IlmImf.dir/IlmImf/ImfStdIO.cpp.o

In file included from /home/luke/cv/opencv_contrib/modules/reg/perf/perf_precomp.hpp:56:0,
                 from /home/luke/cv/opencv-3.4.0/build/modules/reg/opencv_perf_reg_pch_dephelp.cxx:1:
/home/luke/cv/opencv_contrib/modules/reg/include/opencv2/reg/mapperpyramid.hpp:64:114: error: expected ‘;’ at end of member declaration
     CV_WRAP virtual cv::Ptr<Map> calculate(InputArray img1, InputArray img2, cv::Ptr<Map> init = cv::Ptr<Map>()) const CV_OVERRIDE;
/home/luke/cv/opencv_contrib/modules/reg/include/opencv2/reg/mapperpyramid.hpp:64:120: error: ‘CV_OVERRIDE’ does not name a type
     CV_WRAP virtual cv::Ptr<Map> calculate(InputArray img1, InputArray img2, cv::Ptr<Map> init = cv::Ptr<Map>()) const CV_OVERRIDE;
In file included from /home/luke/cv/opencv_contrib/modules/reg/perf/perf_precomp.hpp:56:0,
                 from /home/luke/cv/opencv-3.4.0/build/modules/reg/opencv_perf_reg_pch_dephelp.cxx:1:
/home/luke/cv/opencv_contrib/modules/reg/include/opencv2/reg/mapperpyramid.hpp:66:35: error: expected ‘;’ at end of member declaration
     CV_WRAP cv::Ptr<Map> getMap() const CV_OVERRIDE;
/home /luke/cv/opencv_contrib/modules/reg/include/opencv2/reg/mapperpyramid.hpp:66:41: error: ‘CV_OVERRIDE’ does not name a type
     CV_WRAP cv::Ptr<Map> getMap() const CV_OVERRIDE;


make[2]: *** [modules/reg/CMakeFiles/opencv_test_reg_pch_dephelp.dir/opencv_test_reg_pch_dephelp.cxx.o] Error 1
make[1]: *** [modules/reg/CMakeFiles/opencv_test_reg_pch_dephelp.dir/all] Error 2
make: *** [all] Error 2

This happens I think with each module from opencv_contrib. Ok but this type of syntax errors cannot be in each module..

I have Ubuntu version 14.04LTS and I am using the last released CMake version 3.12.0. Tried older and tried also cmake-gui which version is about 2.8. Does anybody know, what problem it could be ? :( I have tried this several times and don´t know how to solve it.

Just in my opinion: it looks like there could be a problem with a compiler. I don't know maybe it doesn't have some key parameters like c++11 ? But this should CMake make it with their 10 thousands of lines Makefile.. and with their gear. Or Maybe wrong(not good ... (more)

edit retag flag offensive close merge delete


your opencv & contrib versions do not match !

make sure to use the exact same version for opencv and opencv_contrib. if your main is 3.4.0, then you need to check out the very same contrib release. better: update both repos to current 3.4 branch (NOT the same as 3.4.0)

berak gravatar imageberak ( 2018-07-27 08:19:08 -0500 )edit

and no fear, this a known and easy solvable problem !

berak gravatar imageberak ( 2018-07-27 08:20:24 -0500 )edit

Well, If there are more opencv_contrib versions, where I could find it and clone or donwload? I can see only one URL here , there is only 1 repository with opencv_contrib. And Even I am not sure what version it is. only on label near modules folder there is " Merge remote-tracking branch 'upstream/3.4' into merge-3.4 " so I guessed it is 3.4.0 version. I tried again git clone from main instructions both opencv and opencv_contrib and problems are again with "make -j7". You really think that is easy solvable problem? I thought so but i really dont know.. Where do you now think problems could be? :|

Maybe there are some problems in configuration and generation what cause theese problems?

LuMoVo gravatar imageLuMoVo ( 2018-07-28 06:50:09 -0500 )edit

there are branches and releases to choose from. if you don't specify anything, you'll get the master(4.0) branch

berak gravatar imageberak ( 2018-07-28 06:58:26 -0500 )edit

use git:

git clone -b 3.4
git clone -b 3.4
berak gravatar imageberak ( 2018-07-28 07:01:36 -0500 )edit

apart from that, your cmake seems to have a download problem. please inspect /home/luke/cv/last/oc/opencv/build/CMakeDownloadLog.txt

berak gravatar imageberak ( 2018-07-28 07:26:40 -0500 )edit

Aah I see now.. Have allready forgotted about "-b" branches. Well I try prepare again theese 2 versions from this branch. You are right, this is that Log list. It is Available - Basicly from browser I can download that raw.githubusercontent URLs, Cmake doesn't. Unsuported protocol etc or disabled in libcurl. So this really could cause issues in 'make' command.

LuMoVo gravatar imageLuMoVo ( 2018-07-28 08:53:53 -0500 )edit

yea, you can download those things manually, but it's painful. maybe you can update your libbcurl instead ?

berak gravatar imageberak ( 2018-07-28 10:18:25 -0500 )edit

yea. I was doing that. installed the last version of libcurl, also OpenSSL, which is probably connected. I have done ./configure --with-ssl. When I see configured log of libcurl there I see HTTPS on enum of protocols. Soo that should be supported. But Cmake while configuration and generating makes still the same fails with downloads written in warnings ( shown above in my links ). This is being harder then I thought. CMake tells: not supported or disabled in libcurl but libcurl says (it seems like..) suported. Ah. I am thinking about it but dont know what else is wrong.

LuMoVo gravatar imageLuMoVo ( 2018-07-28 11:41:59 -0500 )edit

It seems like maybe CMake is not using libcurl but is set to use some own lib? I was searching about it but dont know how to set it. Or How make sure that cmake is really set to use libcurl which I have updated in my UNIX system.

LuMoVo gravatar imageLuMoVo ( 2018-07-28 14:23:21 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2018-07-29 14:13:10 -0500

LuMoVo gravatar image

Now I have succesfully instaled OpenCV with a extra contrib modules. I had to correctly :

  • Install OpenSSL

  • install Last Release of Libcurl

  • after installing Libcurl I had to recompile last version of CMake with adding parameter to use libcurl in cmake: (in downloaded cmake folder and entered in terminal: sudo ./bootstrap --with-curl -prefix=/usr/local ; sudo make; sudo make install

  • after that I also had to correctly link right libcurl version with instructions here

  • after all theese steps, the last released version of OpenCV 3.4.2 with opencv_contrib-3.4.2 succesfully worked for me ("make -j7" has just one small warning on the start").

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-07-27 08:11:08 -0500

Seen: 403 times

Last updated: Jul 29 '18