opencv_contrib icon indicating copy to clipboard operation
opencv_contrib copied to clipboard

make error with opencv-3.4.0: fatal error: opencv2/xfeatures2d/cuda.hpp: No such file or directory

Open BKZero opened this issue 7 years ago • 14 comments

System information (version)

my cmake configuration is:

cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/opt/local/ \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D INSTALL_C_EXAMPLES=ON \
    -D PYTHON_EXCUTABLE=/usr/bin/python \
    -D OPENCV_EXTRA_MODULES_PATH=~/Program/opencv-3.4.0/opencv_contrib-3.4.0/modules \
    -D WITH_CUDA=OFF \
    -D WITH_CUFFT=OFF \
    -D WITH_CUBLAS=OFF \
    -D WITH_TBB=ON \
    -D WITH_V4L=ON \
    -D WITH_QT=ON \
    -D WITH_GTK=ON \
    -D WITH_OPENGL=ON \
    -D BUILD_EXAMPLES=ON ..

but when i make -j8, i got error:

Scanning dependencies of target opencv_sfm_pch_dephelp
Generating MOC source opencv_cvv_autogen/YMUSIMSHSW/moc_overlayfilterwidget.cpp
[ 10%] Built target opencv_test_videostab_pch_dephelp
[ 10%] Building CXX object modules/optflow/CMakeFiles/opencv_optflow_pch_dephelp.dir/opencv_optflow_pch_dephelp.cxx.o
Scanning dependencies of target numeric
[ 10%] Building CXX object modules/optflow/CMakeFiles/opencv_test_optflow_pch_dephelp.dir/opencv_test_optflow_pch_dephelp.cxx.o
[ 10%] Linking CXX static library ../../lib/libopencv_xfeatures2d_pch_dephelp.a
[ 10%] Building CXX object modules/sfm/CMakeFiles/opencv_sfm_pch_dephelp.dir/opencv_sfm_pch_dephelp.cxx.o
[ 10%] Linking CXX static library ../../lib/libopencv_perf_xfeatures2d_pch_dephelp.a
[ 10%] Building CXX object modules/sfm/src/libmv/libmv/numeric/CMakeFiles/numeric.dir/numeric.cc.o
[ 10%] Built target opencv_xfeatures2d_pch_dephelp
Generating MOC source opencv_cvv_autogen/FU2MQGIDOS/moc_histogram.cpp
Scanning dependencies of target opencv_stitching_pch_dephelp
[ 10%] Built target opencv_perf_xfeatures2d_pch_dephelp
[ 10%] Building CXX object modules/stitching/CMakeFiles/opencv_stitching_pch_dephelp.dir/opencv_stitching_pch_dephelp.cxx.o
[ 10%] Generate files for Python bindings and documentation
In file included from /home/zero/Program/opencv-3.4.0/modules/stitching/include/opencv2/stitching.hpp:49:0,
                 from /home/zero/Program/opencv-3.4.0/modules/stitching/src/precomp.hpp:59,
                 from /home/zero/Program/opencv-3.4.0/build/modules/stitching/opencv_stitching_pch_dephelp.cxx:1:
/home/zero/Program/opencv-3.4.0/modules/stitching/include/opencv2/stitching/detail/matchers.hpp:52:42: fatal error: opencv2/xfeatures2d/cuda.hpp: No such file or directory
 #  include "opencv2/xfeatures2d/cuda.hpp"
                                          ^
compilation terminated.
Generating MOC source opencv_cvv_autogen/FU2MQGIDOS/moc_histogramoptpanel.cpp
[ 10%] Linking CXX static library ../../lib/libopencv_bgsegm_pch_dephelp.a
[ 10%] Linking CXX static library ../../lib/libopencv_perf_ximgproc_pch_dephelp.a
[ 10%] Built target opencv_bgsegm_pch_dephelp
[ 10%] Generating precomp.hpp.gch/opencv_core_RELEASE.gch
[ 10%] Linking CXX static library ../../lib/libopencv_ximgproc_pch_dephelp.a
[ 10%] Built target opencv_perf_ximgproc_pch_dephelp
[ 10%] Generating precomp.hpp.gch/opencv_ts_RELEASE.gch
[ 10%] Built target opencv_ximgproc_pch_dephelp
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_cvvkeypoint.cpp
[ 10%] Generating precomp.hpp.gch/opencv_imgproc_RELEASE.gch
make[2]: *** [modules/stitching/CMakeFiles/opencv_stitching_pch_dephelp.dir/opencv_stitching_pch_dephelp.cxx.o] Error 1
make[1]: *** [modules/stitching/CMakeFiles/opencv_stitching_pch_dephelp.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 10%] Building CXX object modules/sfm/src/libmv/libmv/numeric/CMakeFiles/numeric.dir/poly.cc.o
[ 10%] Linking CXX static library ../../lib/libopencv_test_bgsegm_pch_dephelp.a
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_cvvmatch.cpp
[ 10%] Linking CXX static library ../../lib/libopencv_test_aruco_pch_dephelp.a
[ 10%] Linking CXX static library ../../lib/libopencv_test_ximgproc_pch_dephelp.a
[ 10%] Built target opencv_test_bgsegm_pch_dephelp
[ 10%] Built target opencv_test_aruco_pch_dephelp
[ 10%] Built target opencv_test_ximgproc_pch_dephelp
[ 10%] Linking CXX static library ../../lib/libopencv_face_pch_dephelp.a
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_cvvpointmatch.cpp
[ 10%] Built target opencv_face_pch_dephelp
[ 10%] Linking CXX static library ../../lib/libopencv_perf_optflow_pch_dephelp.a
[ 10%] Linking CXX static library ../../lib/libopencv_optflow_pch_dephelp.a
[ 10%] Built target opencv_perf_optflow_pch_dephelp
[ 11%] Linking CXX static library ../../lib/libopencv_test_face_pch_dephelp.a
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_falsecolorkeypointpen.cpp
[ 11%] Built target opencv_optflow_pch_dephelp
[ 11%] Built target opencv_test_face_pch_dephelp
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_keypointintervallselection.cpp
[ 11%] Linking CXX static library ../../../../../../lib/libnumeric.a
[ 11%] Built target numeric
[ 12%] Linking CXX static library ../../lib/libopencv_sfm_pch_dephelp.a
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_keypointmanagement.cpp
[ 12%] Linking CXX static library ../../lib/libopencv_test_optflow_pch_dephelp.a
[ 12%] Built target opencv_sfm_pch_dephelp
[ 12%] Built target opencv_test_optflow_pch_dephelp
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_keypointselection.cpp
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_keypointselectionselector.cpp
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_keypointsettings.cpp
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_keypointsettingsselector.cpp
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_keypointshowsetting.cpp
[ 12%] Built target gen_opencv_python_source
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_keypointvaluechooser.cpp
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_matchintervallselection.cpp
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_matchmanagement.cpp
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_matchscene.cpp
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_matchselection.cpp
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_matchselectionselector.cpp
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_matchsettings.cpp
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_matchsettingsselector.cpp
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_matchshowsetting.cpp
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_rawview_window.cpp
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_showinrawviewwidget.cpp
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_singlecolorkeypointpen.cpp
Generating MOC source opencv_cvv_autogen/76EPU3OZ3M/moc_singlecolormatchpen.cpp
Generating MOC source opencv_cvv_autogen/FU2MQGIDOS/moc_signalslot.cpp
Generating MOC source opencv_cvv_autogen/FU2MQGIDOS/moc_stfl_query_widget.cpp
Generating MOC source opencv_cvv_autogen/FU2MQGIDOS/moc_stfl_query_widget_completer.cpp
Generating MOC source opencv_cvv_autogen/FU2MQGIDOS/moc_stfl_query_widget_lineedit.cpp
Generating MOC source opencv_cvv_autogen/FU2MQGIDOS/moc_synczoomwidget.cpp
Generating MOC source opencv_cvv_autogen/FU2MQGIDOS/moc_zoomableimage.cpp
Generating MOC source opencv_cvv_autogen/FU2MQGIDOS/moc_zoomableimageoptpanel.cpp
Generating MOC source opencv_cvv_autogen/3JYSCEOBDA/moc_defaultfilterview.cpp
Generating MOC source opencv_cvv_autogen/3JYSCEOBDA/moc_dual_filter_view.cpp
Generating MOC source opencv_cvv_autogen/3JYSCEOBDA/moc_filter_view.cpp
Generating MOC source opencv_cvv_autogen/3JYSCEOBDA/moc_image_view.cpp
Generating MOC source opencv_cvv_autogen/3JYSCEOBDA/moc_linematchview.cpp
Generating MOC source opencv_cvv_autogen/3JYSCEOBDA/moc_match_view.cpp
Generating MOC source opencv_cvv_autogen/3JYSCEOBDA/moc_pointmatchview.cpp
Generating MOC source opencv_cvv_autogen/3JYSCEOBDA/moc_rawview.cpp
[ 12%] Built target pch_Generate_opencv_ts
[ 12%] Built target pch_Generate_opencv_imgproc
[ 12%] Built target pch_Generate_opencv_core
Generating MOC source opencv_cvv_autogen/3JYSCEOBDA/moc_singlefilterview.cpp
Generating MOC source opencv_cvv_autogen/3JYSCEOBDA/moc_translationsmatchview.cpp
Generating MOC compilation opencv_cvv_autogen/moc_compilation.cpp
[ 12%] Built target opencv_cvv_autogen
make: *** [all] Error 2


the error line is:
In file included from /home/zero/Program/opencv-3.4.0/modules/stitching/include/opencv2/stitching.hpp:49:0,
                 from /home/zero/Program/opencv-3.4.0/modules/stitching/src/precomp.hpp:59,
                 from /home/zero/Program/opencv-3.4.0/build/modules/stitching/opencv_stitching_pch_dephelp.cxx:1:
/home/zero/Program/opencv-3.4.0/modules/stitching/include/opencv2/stitching/detail/matchers.hpp:52:42: fatal error: opencv2/xfeatures2d/cuda.hpp: No such file or directory
 #  include "opencv2/xfeatures2d/cuda.hpp"
                                          ^
compilation terminated.

BKZero avatar Jan 26 '18 09:01 BKZero

I have search for other issue about this problem and try those solution but it does not work for me. and most of them is for opencv 3.2

BKZero avatar Jan 26 '18 09:01 BKZero

i met the same problem , i have no idea

cshang412 avatar May 10 '18 12:05 cshang412

the same problem...

PumayHui avatar Aug 02 '18 08:08 PumayHui

I've come across the same issue, and solved by

cmake -DBUILD_opencv_xfeatures2d=OFF ..

according to https://github.com/opencv/opencv_contrib/issues/1131

Firststep2014 avatar Aug 02 '18 14:08 Firststep2014

the same problem for 3.4.3

telesoho avatar Nov 06 '18 09:11 telesoho

-DBUILD_opencv_xfeatures2d=OFF is not a "solution". The contrib xfeatures2d is not supposed to depend on CUDA, does it ?

orzel avatar Jul 14 '19 12:07 orzel

解决办法: 在CMakeLists.txt增加以下内容:

INCLUDE_DIRECTORIES("/works/opencv-3.4.0/opencv_contrib-3.4.0/modules/xfeatures2d/include") 1 CMakeLists.txt文件所在路径为:

<你的路径>/opencv-3.4.0/modules/stitching/ CMakeLists.txt ———————————————— 版权声明:本文为CSDN博主「Colin.Tan」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/qq_33475105/article/details/82819850

northeastsquare avatar Sep 20 '19 16:09 northeastsquare

My solution is that copying the folder"modules/xfeatures2d/include/opencv2/" to the area where the error occurs.

zhangyugsy avatar Dec 10 '19 06:12 zhangyugsy

I used the way that copying the folder"modules/xfeatures2d/include/opencv2/" to the area ,however ,I failed.so,who has the better way?

renjiahao0928 avatar Jun 19 '20 13:06 renjiahao0928

I used the way that copying the folder"modules/xfeatures2d/include/opencv2/" to the area ,however ,I failed.so,who has the better way?

copy folder? I copy the complete path where cuda.hpp is to the area where the error, I get success on make.

shaber2017 avatar Jun 19 '20 15:06 shaber2017

I used the way that copying the folder"modules/xfeatures2d/include/opencv2/" to the area ,however ,I failed.so,who has the better way?

copy folder? I copy the complete path where cuda.hpp is to the area where the error, I get success on make.

could you please show your complete path to me? i really don't know where the path of the cuda.hpp is.thanks

renjiahao0928 avatar Jun 20 '20 09:06 renjiahao0928

I used the way that copying the folder"modules/xfeatures2d/include/opencv2/" to the area ,however ,I failed.so,who has the better way?

copy folder? I copy the complete path where cuda.hpp is to the area where the error, I get success on make.

could you please show your complete path to me? i really don't know where the path of the cuda.hpp is.thanks

okay, I added this path "/home/cw/mytool/opencv-3.4.6/opencv_contrib-3.4.6/modules/xfeatures2d/include/opencv2/xfeatures2d/cuda.hpp" replacing 52 line that is "opencv2/xfeatures2d/cuda.hpp" in file which path is "opencv-3.4.0/modules/stitching/include/opencv2/stitching/detail/matchers.hpp"

shaber2017 avatar Jun 22 '20 07:06 shaber2017

what I did in my docker is to do this:

sed -i '6i  INCLUDE_DIRECTORIES\(\"/root/opencv_contrib-3.4.1/modules/xfeatures2d/include\"\)' /root/opencv/modules/stitching/CMakeLists.txt

Please modify the line number 6i and /root/opencv_contrib-3.4.1 based on your custom version.

rancheng avatar May 26 '22 14:05 rancheng

@rancheng If I just write sed -i '6i INCLUDE_DIRECTORIES("/root/opencv_contrib-3.4.1/modules/xfeatures2d/include")' /root/opencv/modules/stitching/CMakeLists.txt Can it work?

yeyanan93 avatar Aug 05 '22 06:08 yeyanan93