Opencv_contrib: ubuntu build make error

Created on 24 Dec 2018  ·  20Comments  ·  Source: opencv/opencv_contrib

make -j8 error

Scanning dependencies of target opencv_test_ximgproc
/home/zkl/zklcode/code/pycv/opencv_contrib/modules/xfeatures2d/test/test_rotation_and_scale_invariance.cpp:7:82: fatal error: features2d/test/test_detectors_invariance.impl.hpp: No such file or directory
compilation terminated.
Scanning dependencies of target opencv_perf_xfeatures2d
modules/xfeatures2d/CMakeFiles/opencv_test_xfeatures2d.dir/build.make:110: recipe for target 'modules/xfeatures2d/CMakeFiles/opencv_test_xfeatures2d.dir/test/test_rotation_and_scale_invariance.cpp.o' failed
make[2]: * [modules/xfeatures2d/CMakeFiles/opencv_test_xfeatures2d.dir/test/test_rotation_and_scale_invariance.cpp.o] Error 1
make[2]: *
Waiting for unfinished jobs....

Scanning dependencies of target opencv_test_aruco
[ 86%] Building CXX object modules/aruco/CMakeFiles/opencv_test_aruco.dir/test/test_misc.cpp.o
CMakeFiles/Makefile2:14780: recipe for target 'modules/xfeatures2d/CMakeFiles/opencv_test_xfeatures2d.dir/all' failed
make[1]: * [modules/xfeatures2d/CMakeFiles/opencv_test_xfeatures2d.dir/all] Error 2
make[1]: *
Waiting for unfinished jobs....

incomplete question (invalid tracker)

Most helpful comment

I solved it by copying opencv/modules/features2d to my build directory.

All 20 comments

I meet a similar error, any suggestion?

cmake -D CMAKE_INSTALL_PREFIX=/usr/local -D CMAKE_BUILD_TYPE=Release -D OPENCV_EXTRA_MODULES_PATH=<opencv_contrib/modules> <opencv>

make -j4

/home/middlto/opencv/opencv-4.1.0/opencv_contrib/modules/xfeatures2d/test/test_features2d.cpp:51:62: fatal error: features2d/test/test_detectors_regression.impl.hpp: No such file or directory
 #include "features2d/test/test_detectors_regression.impl.hpp"

Opencv and opencv_contrib are both 4.1.0.

Complete compiler command line is required via VERBOSE=1 make.

I solved it by copying opencv/modules/features2d to my build directory.

I solved it by copying opencv/modules/features2d to my build directory.

@middlto
Hi middlto, many thanks to your answer, but I'm confused by your expression, can you explain more about this, do you mean copying opencv/modules/features2d/test into opencv/build/modules/features2d/test or ? Cause I still got error when make after doing this.

I also have this problem.

I solve this problem

we can't find these file
//#include "features2d/test/test_detectors_regression.impl.hpp"
//#include "features2d/test/test_descriptors_regression.impl.hpp"

then modify the relative path to absolute path

include "/data/raid/project/software/opencv4.0.0/modules/features2d/test/test_detectors_regression.impl.hpp"

include "/data/raid/project/software/opencv4.0.0/modules/features2d/test/test_descriptors_regression.impl.hpp"

There are special lines to handle that.

Request is still the same:

Complete compiler command line is required via VERBOSE=1 make

I got the error too.
Here is the log with VERBOSE=1 make

cd /home/pi/opt/opencv-4.1.0/build/modules/xfeatures2d && /usr/bin/c++  -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1 -D__OPENCV_TESTS=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MAC
ROS -I/home/pi/opt/opencv-4.1.0/build -I/home/pi/opt/opencv-4.1.0/modules/ts/include -I/home/pi/op
t/opencv_contrib-4.1.0/modules/xfeatures2d/include -I/home/pi/opt/opencv-4.1.0/modules/imgcodecs/include -I/home/pi/opt/opencv-4.1.0/modules/videoio/include -I/home/pi/opt/opencv-4.1.0/modules/core/include -I/home/pi/opt/opencv-4.1.0/modules/flann/include -I/home/pi/opt/opencv-4.1.0/modules/imgproc/include -I/home/pi/opt/opencv-4.1.0/modules/ml/include -I/home/pi/opt/opencv-4.1.0/modules/highgui/include -I/home/pi/opt/opencv-4.1.0/modules/features2d/include -I/home/pi/opt/opencv-4.1.0/modules/calib3d/include -I/home/pi/opt/opencv_contrib-4.1.0/modules/shape/include  -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -mfp16-format=ieee -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG -fPIE   -std=c++11  -Winvalid-pch  -include "/home/pi/opt/opencv-4.1.0/build/modules/xfeatures2d/test_precomp.hpp" -o CMakeFiles/opencv_test_xfeatures2d.dir/test/test_features2d.cpp.o -c /home/pi/opt/opencv_contrib-4.1.0/modules/xfeatures2d/test/test_features2d.cpp             
/home/pi/opt/opencv_contrib-4.1.0/modules/xfeatures2d/test/test_features2d.cpp:51:10: fatal error: features2d/test/test_detectors_regression.impl.hpp: No such file or directory                   
 #include "features2d/test/test_detectors_regression.impl.hpp"                                   
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                   
compilation terminated.
make[2]: *** [modules/xfeatures2d/CMakeFiles/opencv_test_xfeatures2d.dir/build.make:76: modules/xf
eatures2d/CMakeFiles/opencv_test_xfeatures2d.dir/test/test_features2d.cpp.o] Error 1             

For some reason there is missing -I/home/pi/opt/opencv-4.1.0/modules compiler option in command line.

What is CMake version used?
Could you try to build without PCH support: cmake -DENABLE_PRECOMPILED_HEADERS=OFF ...?

It seems like cmake building break by network problem. When I delete build folder and rebuild again, the problem is gone.

I solve this problem

we can't find these file
//#include "features2d/test/test_detectors_regression.impl.hpp"
//#include "features2d/test/test_descriptors_regression.impl.hpp"

then modify the relative path to bsolute path

include "/data/raid/project/software/opencv4.0.0/modules/features2d/test/test_detectors_regression.impl.hpp"

include "/data/raid/project/software/opencv4.0.0/modules/features2d/test/test_descriptors_regression.impl.hpp"

Same problem, and solved it by your method! Thanks!

It is a workaround to make the compilation continue. 😄

Workaround1: cmake -DBUILD_TESTS=OFF ...
Workaround2: cmake -DBUILD_opencv_xfeatures2d=OFF ...

What is version of CMake used?

Workaround: cmake -DBUILD_TESTS=OFF ...

What is version of CMake used?

Cmake 3.10.2.

And here is the command I used under directory opencv-4.1.2/build:

cmake -DOPENCV_EXTRA_MODULES_PATH=/home/kerry/workspace/opencv_contrib-4.1.2/modules -DOPENCV_GENERATE_PKGCONFIG=ON ..

Repositories are downloaded from corresponding release page.

Still can't reproduce with:

  • CMake 3.14.5
  • CMake 3.10.0

Please check for these lines in CMake output (no errors are expected)

-- xfeatures2d/boostdesc: Download: boostdesc_bgm.i
-- xfeatures2d/boostdesc: Download: boostdesc_bgm_bi.i
-- xfeatures2d/boostdesc: Download: boostdesc_bgm_hd.i
-- xfeatures2d/boostdesc: Download: boostdesc_binboost_064.i
-- xfeatures2d/boostdesc: Download: boostdesc_binboost_128.i
-- xfeatures2d/boostdesc: Download: boostdesc_binboost_256.i
-- xfeatures2d/boostdesc: Download: boostdesc_lbgm.i
-- xfeatures2d/vgg: Download: vgg_generated_48.i
-- xfeatures2d/vgg: Download: vgg_generated_64.i
-- xfeatures2d/vgg: Download: vgg_generated_80.i
-- xfeatures2d/vgg: Download: vgg_generated_120.i

and check "Unavailable" list of modules - xfeatures2d should not be in this list.
If it is there, then probably it is network problem (missing required external files)

我通过将opencv / modules / features2d复制到构建目录中来解决该问题。

yes,it works!just do it——Copy the 'features2d' directory from ‘’opencv / modules /‘’ to ‘build/’.
Thanks for solving my problem.

i add “include_directories("${CMAKE_CURRENT_SOURCE_DIR}/modules")” in CMakelist.txt。it works also

@nihuizhidao cp -r ~/opencv/modules/features2d ~/opencv/build
although i don't know how it works

Looks like this mostly happens if there isn't any networking during the configure step.

edit the file:
opencv/build/modules/xfeatures2d/CMakeFiles/opencv_test_xfeatures2d.dir/build.make
by adding "-I/path/to/opencv/modules/" to the cpp.o rules

I solved it by copying opencv/modules/features2d to my build directory.

great!it solve my problem!

Was this page helpful?
0 / 5 - 0 ratings