ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The parenthesis that you observed in your compilation calls are definitions for function-like macros, and are valid preprocessor directives for the gcc compiler. However, they are not valid for certain CUDA compilers due the latter's inability to handle these redunant spaces between the characters that you observed.

What is likely happening is that your code uses the Point Cloud Library (PCL), with some necessary variables for it loaded into your CMakeLists.txt through the find_package(PCL) command, which runs PCLConfig.cmake. Since PCL depends on VTK (Visualization Toolkit), PCLConfig.cmake runs UseVTK.cmake. The latter file, due to poor design, adds flags into the CMAKE_C_FLAGS and CMAKE_CXX_FLAGS directly (as opposed to adding them to something like VTK_CXX_FLAGS so that the user could use these flags optionally). This has the unintended consequence that the flags are passed to nvcc due to the way FindCUDA.cmake is set up: https://github.com/Kitware/CMake/blob/master/Modules/FindCUDA.cmake#L1407. Due to the fact that nvcc can't handle function-like macros with spaces around the parenthesis, an error is given.

As a solution, one can clear all the compiler flags (thus getting rid of the redundant function-like macros due to VTK) by using the set_directory_properties( PROPERTIES COMPILE_DEFINITIONS "" ) command in cmake before building cuda with the CUDA_COMPILE cmake macro.