2016-12-16 52 views
1

我使用的是Ubuntu 14.04,使用cuda 8.0构建opencv 3.1.0。在ubuntu下使用cuda支持构建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运行时库版本,请更新它。”

任何人都可以帮忙吗?

错误:

[ 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

是否有可能安装了多个版本的CUDA? –

+0

不,我只安装了cuda 8.0。 –

+0

不,我只安装了cuda 8.0,我使用的GTX 960M的驱动程序是最新的:375.26 –

回答

1

林宇阳,

的问题是,你必须安装CUDA的多个版本。 可能当您上次cuda版本升级时,来自其他版本的某些文件仍然保留在您的系统中。

查找使用如下命令库: dconfig -p | grep libcudart

此命令显示您机器上的libcudart版本。但删除旧的库并不能解决你的问题。由于CUDART_VERSION小于所需(CUDART_MINIMUM_REQUIRED_VERSION)下 /opencv/modules/core/include/opencv2/core/private.cuda.hpp :

的问题发生在文件中。

搜索放在/ usr /为: grep --include=\*.{c,cpp,h,hpp} -rnw '/usr/' -e "define CUDART_VERSION"

也许你会发现在/ usr /本地/ CUDA实际版本/和一些包含文件在/ usr/include中/: 在这个文件: /usr/include/cuda_runtime_api.h 您找到了错误的版本。

我解决了这个问题,比较文件夹并用新的(/ usr/local/cuda/include /)覆盖旧的cuda头文件(/ usr/include /)。

另一种方法是删除使用apt或NVIDIA安装程序二进制文件(* .RUN)所有版本: sudo apt-get remove --purge nvidia-*

但是,你需要重新安装所有库。

相关问题