Ask Your Question

Revision history [back]

OpenCV 3.4.2 Compilation Error with Surface Tracking Module

Hello,

I am updating from OpenCV 3.4.1 to 3.4.2 and have a script to automatically download and compile OpenCV. This script errors out with the following error message when compiling 3.4.2 but runs perfectly fine with 3.4.1. Does anyone know if a dependency/requirement has changed? My script is below.

Error:

In file included from /opencv-3.4.2/modules/core/include/opencv2/core/cuda/vec_traits.hpp:46:0,
                 from /opencv-3.4.2/modules/cudaoptflow/src/precomp.hpp:55,
                 from /opencv-3.4.2/Build/modules/cudaoptflow/opencv_cudaoptflow_pch_dephelp.cxx:1:
/opencv-3.4.2/modules/core/include/opencv2/core/cuda/common.hpp:46:26: fatal error: cuda_runtime.h: No such file or directory
compilation terminated.
modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow_pch_dephelp.dir/build.make:62: recipe for target 'modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow_pch_dephelp.dir/opencv_cudaoptflow_pch_dephelp.cxx.o' failed
make[2]: *** [modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow_pch_dephelp.dir/opencv_cudaoptflow_pch_dephelp.cxx.o] Error 1
CMakeFiles/Makefile2:8126: recipe for target 'modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow_pch_dephelp.dir/all' failed
make[1]: *** [modules/cudaoptflow/CMakeFiles/opencv_cudaoptflow_pch_dephelp.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

Script:

wget https://github.com/opencv/opencv/archive/3.4.2.zip
unzip 3.4.2.zip
wget https://github.com/opencv/opencv_contrib/archive/3.4.2.zip -O opencv_contrib-3.4.2.zip
unzip opencv_contrib-3.4.2.zip
mkdir modules
cp -r opencv_contrib-3.4.2/modules/surface_matching modules/surface_matching
cd opencv-3.4.2 && mkdir Build && cd Build && cmake -DOPENCV_EXTRA_MODULES_PATH=../../modules/ -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_CUDA_STUBS=ON -DBUILD_PNG=ON -DENABLE_FAST_MATH=ON -DCUDA_FAST_MATH=ON -DCMAKE_INSTALL_PREFIX=/usr/local -DWITH_OPENGL=ON -DENABLE_CXX11=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_V4L=ON -DWITH_QT=ON  -DWITH_CUBLAS=ON -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES --expt-relaxed-constexpr" -DWITH_GDAL=ON -DWITH_XINE=ON -DBUILD_EXAMPLES=OFF .. && make -j $(($(nproc) + 1)) && make install