'modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/all' failed

在编译安装opencv3.1时可能会报错
modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/build.make:290: recipe for target ‘modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/src/graphcuts.cpp.o’ failed 
make[2]: *** [modules/cudalegacy/CMakeFiles/opencv_cudalegacy.dir/src/graphcuts.cpp.o] Error

这是CUDA配置出错。

解决办法1:不用CUDA在cmake时设置-DWITH_CUDA=OFF

解决办法2:GraphCut在cuda7.5中弃用,在cuda8.0中被移除。

修改 ~/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp文件 
把第45行修改成:

#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) || (CUDART_VERSION >= 8000)

即在 \#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) 加上 || (CUDART_VERSION >= 8000)


你可能感兴趣的:(深度学习)