ubuntu opencv compilation error/bug with cuda 8.0 RC

使用源码编译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.o

modules/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' failed
make[2]: *** [modules/cudaimgproc/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gftt.cu.o] Error 1
CMakeFiles/Makefile2:4419: recipe for target 'modules/cudaimgproc/CMakeFiles/opencv_cudaimgproc.dir/all' failed
make[1]: *** [modules/cudaimgproc/CMakeFiles/opencv_cudaimgproc.dir/all] Error 2
Makefile:160: recipe for target 'all' failed

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

# find the thrust directory
find /usr/local/cuda -type d -name "thrust" 
# clone the 1.8.3 thrust from github
git clone https://github.com/thrust/thrust.git -b 1.8.3
# diff them
diff -u thrust /usr/local/cuda/include/thrust
# backup the cuda/thrust
sudo mv /usr/local/cuda/include/thrust /usr/local/cuda/include/thrust_old
# move the thrust to cuda dir
sudo mv ./thrust /usr/local/cuda/include/thrust

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

  • opencv:3.1.0(master)
  • cuda:8.0.26
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值