我正在使用Ubuntu 14.04,使用cuda 8.0构建opencv 3.1.0。
cmake命令:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -DOPENCV_EXTRA_MODULES_PATH=/home/lindeyang/library/opencv_contrib/modules ..
在cmake配置之后,我开始构建,但是遇到了问题: " Cuda Runtime库版本不足,请更新它。"
有人可以帮忙吗?
错误:
[ 0%] Built target opencv_cudev
[ 0%] [ 0%] Built target opencv_ts_pch_dephelp
Building CXX object modules/core/CMakeFiles/opencv_core_pch_dephelp.dir/opencv_core_pch_dephelp.cxx.o
[ 2%] Built target libwebp
[ 2%] Built target opencv_imgproc_pch_dephelp
[ 2%] Built target opencv_imgcodecs_pch_dephelp
[ 2%] Built target opencv_videoio_pch_dephelp
[ 2%] Automoc for target opencv_highgui_pch_dephelp
[ 2%] Automoc for target opencv_highgui
[ 2%] Built target opencv_perf_core_pch_dephelp
[ 2%] Built target opencv_highgui_pch_dephelp_automoc
[ 2%] Built target opencv_highgui_automoc
[ 2%] Built target opencv_test_core_pch_dephelp
Scanning dependencies of target opencv_perf_cudaarithm_pch_dephelp
[ 2%] Scanning dependencies of target opencv_test_cudaarithm_pch_dephelp
Building CXX object modules/cudaarithm/CMakeFiles/opencv_cudaarithm_pch_dephelp.dir/opencv_cudaarithm_pch_dephelp.cxx.o
[ 2%] Building CXX object modules/cudaarithm/CMakeFiles/opencv_perf_cudaarithm_pch_dephelp.dir/opencv_perf_cudaarithm_pch_dephelp.cxx.o
[ 2%] Building CXX object modules/cudaarithm/CMakeFiles/opencv_test_cudaarithm_pch_dephelp.dir/opencv_test_cudaarithm_pch_dephelp.cxx.o
In file included from /home/lindeyang/library/opencv/modules/core/src/precomp.hpp:56:0,
from /home/lindeyang/library/opencv/build/modules/core/opencv_core_pch_dephelp.cxx:1:
/home/lindeyang/library/opencv/modules/core/include/opencv2/core/private.cuda.hpp:70:6: error: #error "Insufficient Cuda Runtime library version, please update it."
# error "Insufficient Cuda Runtime library version, please update it."
^
In file included from /home/lindeyang/library/opencv/modules/cudaarithm/src/precomp.hpp:53:0,
from /home/lindeyang/library/opencv/build/modules/cudaarithm/opencv_cudaarithm_pch_dephelp.cxx:1:
/home/lindeyang/library/opencv/modules/core/include/opencv2/core/private.cuda.hpp:70:6: error: #error "Insufficient Cuda Runtime library version, please update it."
# error "Insufficient Cuda Runtime library version, please update it."
^
make[2]: *** [modules/cudaarithm/CMakeFiles/opencv_cudaarithm_pch_dephelp.dir/opencv_cudaarithm_pch_dephelp.cxx.o] Error 1
make[1]: *** [modules/cudaarithm/CMakeFiles/opencv_cudaarithm_pch_dephelp.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Linking CXX static library ../../lib/libopencv_test_cudaarithm_pch_dephelp.a
[ 2%] Built target opencv_test_cudaarithm_pch_dephelp
Linking CXX static library ../../lib/libopencv_perf_cudaarithm_pch_dephelp.a
[ 2%] Built target opencv_perf_cudaarithm_pch_dephelp
make[2]: *** [modules/core/CMakeFiles/opencv_core_pch_dephelp.dir/opencv_core_pch_dephelp.cxx.o] Error 1
make[1]: *** [modules/core/CMakeFiles/opencv_core_pch_dephelp.dir/all] Error 2
make: *** [all] Error 2
附图片: [deviceQuery ][1]
的结果答案 0 :(得分:1)
问题是您安装了多个版本的CUDA。 可能在您上次cuda版本升级时,另一个版本的某些文件仍保留在您的系统中。
使用以下命令查找libs:
dconfig -p | grep libcudart
此命令显示计算机上的libcudart版本。但删除旧的库不能解决您的问题。
问题发生在文件中: /opencv/modules/core/include/opencv2/core/private.cuda.hpp 因为CUDART_VERSION低于要求的值(CUDART_MINIMUM_REQUIRED_VERSION)。
在/ usr /上搜索:
grep --include=\*.{c,cpp,h,hpp} -rnw '/usr/' -e "define CUDART_VERSION"
您可能会在/ usr / local / cuda /中找到实际版本,并在/ usr / include /中找到一些包含文件: 在这个文件中: /usr/include/cuda_runtime_api.h 你找到了错误的版本。
我解决了这个问题,比较文件夹并用新的覆盖旧的cuda标头(/ usr / include /)(/ usr / local / cuda / include /)。
另一种方法是使用apt或NVIDIA安装程序二进制文件(* .run)删除所有版本:
sudo apt-get remove --purge nvidia-*
但是,您需要重新安装所有库。