Error compiling openCV 4.1.2 with CUDA 9.0 in Ubuntu 16.04
Here's my cmake command:
cmake -D CMAKE_BUILD_TYPE=DEBUG\
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D CUDA_ARCH_BIN="6.1" \
-D WITH_TBB=ON \
-D WITH_CUDA=ON \
-D BUILD_opencv_cudacodec=OFF \
-D ENABLE_FAST_MATH=1 \
-D CUDA_FAST_MATH=1 \
-D WITH_CUBLAS=1 \
-D WITH_V4L=ON \
-D WITH_QT=OFF \
-D WITH_OPENGL=ON \
-D WITH_GSTREAMER=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_PC_FILE_NAME=opencv.pc \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_PYTHON3_INSTALL_PATH=~/venv/lib/python3.5/site-packages \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv/opencv_contrib/modules \
-D PYTHON_EXECUTABLE=~/venv/bin/python \
-D PYTHON_DEFAULT_EXECUTABLE=~/venv/bin/python3.5 \
-D BUILD_EXAMPLES=ON ..
Configuring and generating are successful. However, when I tried to compile it. This error appears:
/home/jaylo/opencv/modules/dnn/src/cuda/math.hpp(30): error: no operator "+" matches these operands
operand types are: __half2 + __half2
/home/jaylo/opencv/modules/dnn/src/cuda/math.hpp(54): error: no operator "+" matches these operands
operand types are: __half2 + __half2
/home/jaylo/opencv/modules/dnn/src/cuda/math.hpp(119): error: no operator "+" matches these operands
operand types are: __half2 + __half2
3 errors detected in the compilation of "/tmp/tmpxft_000048a8_00000000-6_activations.cpp1.ii".
CMake Error at cuda_compile_1_generated_activations.cu.o.DEBUG-D.cmake:281 (message):
Error generating file
/home/jaylo/opencv/build/modules/dnn/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_activations.cu.o
modules/dnn/CMakeFiles/opencv_dnn.dir/build.make:434: recipe for target 'modules/dnn/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_activations.cu.o' failed
make[2]: *** [modules/dnn/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_activations.cu.o] Error 1
CMakeFiles/Makefile2:4972: recipe for target 'modules/dnn/CMakeFiles/opencv_dnn.dir/all' failed
make[1]: *** [modules/dnn/CMakeFiles/opencv_dnn.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
What is happening here?