ros-industrial / yak

A library for integrating depth images into Truncated Signed Distance Fields.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Melodic build gets cuda error about only supports gcc < 6

Levi-Armstrong opened this issue · comments

Add cuda options OPTIONS --compiler-bindir /usr/bin/gcc-6 below to get it no build without changing your host gcc version.

cuda_add_library(${PROJECT_NAME}
  src/kfusion/core.cpp
  src/kfusion/device_memory.cpp
  src/kfusion/imgproc.cpp
  src/kfusion/kinfu.cpp
  src/kfusion/precomp.cpp
  src/kfusion/projective_icp.cpp
  src/kfusion/tsdf_volume.cpp
  src/cuda/imgproc.cu
  src/cuda/proj_icp.cu
  src/cuda/tsdf_volume.cu
  OPTIONS --compiler-bindir /usr/bin/gcc-6
)

It's worth noting that the supported version of GCC is a function of both the OS distribution and the CUDA version. There's a table in the CUDA installation guide (here for the latest, here for 9.2, here for 8.0) that says what version is supported in different situations. In other words, not necessarily something you'd want to have hard-coded.

I think the most common situation where this crops up is when building to support an older GPU with a newer OS (e.g. using hardware that only supports up to CUDA 9.1 on Ubuntu 18.04).

So what is the long term fix for this? Should we add a series of checks that set the correct option based on CUDA_VERSION_MAJOR?

In any case the user has to have the correct version of GCC installed, so I don't think it can be handled totally automatically.

The nature of this problem may have changed a bit with the improved CUDA support in CMake 3.10 and newer, though we'll need to test on the appropriate combination of drivers and hardware. Pointing to a specific GCC version can now be done via set_target_properties:

add_library(${PROJECT_NAME} SHARED  # the core yak library
  src/kfusion/core.cpp
  src/kfusion/device_memory.cpp
  src/kfusion/imgproc.cpp
  src/kfusion/kinfu.cpp
  src/kfusion/precomp.cpp
  src/kfusion/projective_icp.cpp
  src/kfusion/tsdf_volume.cpp
  src/cuda/imgproc.cu
  src/cuda/proj_icp.cu
  src/cuda/tsdf_volume.cu)
set_target_properties(${PROJECT_NAME} PROPERTIES CMAKE_CUDA_HOST_COMPILER /usr/bin/gcc-6)