编译CUDA和PCL点云库的出错问题

今天在编写一个同时使用CUDA和PCL的程序时,发现编译始终报错:

  • 一个是警告信息:
CMake Warning (dev) in cuda_gpu_generated_test.cu.o.cmake:
  Syntax Warning in cmake code at

    /home/xxx/mytsdf-fusion/build/mytsdf/CMakeFiles/cuda_gpu.dir/src/cuda_gpu_generated_test.cu.o.cmake:79:137

  Argument not separated from preceding token by whitespace.
This warning is for project developers.  Use -Wno-dev to suppress it.
  • 一个是错误:
nvcc fatal   : A single input file is required for a non-link phase when an outputfile is specified
CMake Error at cuda_gpu_generated_test.cu.o.cmake:207 (message):
  Error generating
  /home/xxx/mytsdf-fusion/build/mytsdf/CMakeFiles/cuda_gpu.dir/src/./cuda_gpu_generated_test.cu.o


mytsdf/CMakeFiles/cuda_gpu.dir/build.make:63: recipe for target 'mytsdf/CMakeFiles/cuda_gpu.dir/src/cuda_gpu_generated_test.cu.o' failed

在网上查找了一些资料后,发现需要在CMakeLists.txt的依赖项后中添加:

get_directory_property(dir_defs DIRECTORY ${PROJECT_SOURCE_DIR} COMPILE_DEFINITIONS)
set(vtk_flags)
foreach(it ${dir_defs})
    if(it MATCHES "vtk*")
    list(APPEND vtk_flags ${it})
    endif()
endforeach()

foreach(d ${vtk_flags})
    remove_definitions(-D${d})
endforeach()

并在cuda的依赖项后添加

set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};--disable-warnings;--ptxas-options=-v;-use_fast_math;-lineinfo;-std=c++11)

这样就可以成功编译了。


参考:

https://www.jianshu.com/p/1dc40d2b78c8

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值