2016-12-16 76 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-*

但是,你需要重新安裝所有庫。

相關問題