unable to complete 'make -j7' with opencv_

2019-08-30 19:29发布

问题:

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:

cmake -DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DINSTALL_C_EXAMPLES=OFF \
-DINSTALL_PYTHON_EXAMPLES=OFF \
-DBUILD_EXAMPLES=OFF
-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 enouh) GNU/GCC version ?

I see I have in folder /usr/bin/ file "gcc-4.8". I don´t know if I am using version 4.8 but I cannot see any else version "gcc-x.y" file in this folder.

Well, img1

Maybe I could try something with changing make generator ?

But in cmake-gui I have only theese options: img2

I also tried more versions of OpenCV. My last version I have tried now is 3.4.0. (but also 3.4.1 and 3.4.2..) Are there also more version of opencv_contrib modules? I cannot find more versions. And this version of opencv_contrib seems to be 3.4.

Where do you think that problem could be? Any tips for solving this? I wanted to use these extra modules in my projects.