ubuntu opencv compilation error/bug with cuda 8.0 RC

来源:互联网 发布:淘宝办理出版物许可证 编辑:程序博客网 时间:2024/06/06 23:54

使用源码编译opencv master分支(3.1.0)时,出现如下错误:

/usr/local/cuda/include/thrust/detail/reference.inl(127): error: no default constructor exists for class "thrust::detail::execute_with_allocator<cv::cuda::device::ThrustAllocator, thrust::system::cuda::detail::execute_on_stream_base>"          detected during:            instantiation of "void thrust::reference<Element, Pointer, Derived>::assign_from(OtherPointer) [with Element=float2, Pointer=thrust::pointer<float2, thrust::detail::execute_with_allocator<cv::cuda::device::ThrustAllocator, thrust::system::cuda::detail::execute_on_stream_base>, thrust::use_default, thrust::use_default>, Derived=thrust::use_default, OtherPointer=const float2 *]" (65): here......4 errors detected in the compilation of "/tmp/tmpxft_00003fb9_00000000-17_gftt.compute_60.cpp1.ii".CMake Error at cuda_compile_generated_gftt.cu.o.cmake:264 (message):  Error generating file  /home/chengxiang/workspace/opencv/build/modules/cudaimgproc/CMakeFiles/cuda_compile.dir/src/cuda/./cuda_compile_generated_gftt.cu.omodules/cudaimgproc/CMakeFiles/opencv_cudaimgproc.dir/build.make:3603: recipe for target 'modules/cudaimgproc/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gftt.cu.o' failedmake[2]: *** [modules/cudaimgproc/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gftt.cu.o] Error 1CMakeFiles/Makefile2:4419: recipe for target 'modules/cudaimgproc/CMakeFiles/opencv_cudaimgproc.dir/all' failedmake[1]: *** [modules/cudaimgproc/CMakeFiles/opencv_cudaimgproc.dir/all] Error 2Makefile:160: recipe for target 'all' failed

这是一个cuda8.0 rc版本bug, 使用github上的thrust 1.8.3tag替换cuda8.0rc安装时的thrust即可.

# find the thrust directoryfind /usr/local/cuda -type d -name "thrust" # clone the 1.8.3 thrust from githubgit clone https://github.com/thrust/thrust.git -b 1.8.3# diff themdiff -u thrust /usr/local/cuda/include/thrust# backup the cuda/thrustsudo mv /usr/local/cuda/include/thrust /usr/local/cuda/include/thrust_old# move the thrust to cuda dirsudo mv ./thrust /usr/local/cuda/include/thrust

实际测试通过,配置如下:

  • opencv:3.1.0(master)
  • cuda:8.0.26
1 0
原创粉丝点击