Having trouble compiling ROS node (include cuda and pcl ) using catkin_make?

I would like to compile CUDA on Ros. However, when I add find_package (PCL REQUIRED) inside cmakelist,then will appear nvcc fatal: A single input file is required for a non-link phase when an outputfile is specified this error

Thank you very much!!! Hope your help.

Hi,

Here is a ROS setting tutorial for your reference:

Thanks

you may don’t understand what I mean. I have already installed ROS. But I have trouble in compiling the program(with cuda and PCL).
these is my Cmakelist:

cmake_minimum_required(VERSION 2.8.3)
project(roscuda_basic)

find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
)

find_package(CUDA REQUIRED)
find_package(OpenCV REQUIRED)
find_package(PCL 1.8 REQUIRED)

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

catkin_package(

INCLUDE_DIRS include

LIBRARIES roscuda_basic

CATKIN_DEPENDS roscpp rospy std_msgs

DEPENDS system_lib

)

include_directories(

include

${catkin_INCLUDE_DIRS}

${PCL_INCLUDE_DIRS}

)

set(CUDA_NVCC_FLAGS “-arch=compute_30” CACHE STRING “nvcc flags” FORCE)
set(CUDA_VERBOSE_BUILD ON CACHE BOOL “nvcc verbose” FORCE)
set(LIB_TYPE STATIC)

cuda_add_library(CUDASampLib SHARED ${LIB_TYPE} src/basic.cu)

add_executable(roscuda_basic_node src/main.cpp)

add_dependencies(roscuda_basic_node CUDASampLib)

TARGET_LINK_LIBRARIES(roscuda_basic_node
CUDASampLib
${catkin_LIBRARIES}
${PCL_LIBRARIES}
${OpenCV_LIBS}
)

then the error is:

CMake Warning (dev) in CUDASampLib_generated_basic.cu.o.cmake:
Syntax Warning in cmake code at

/home/ubuntu/roscuda/build/roscuda_basic/CMakeFiles/CUDASampLib.dir/src/CUDASampLib_generated_basic.cu.o.cmake:79:172

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) in CUDASampLib_generated_basic.cu.o.cmake:
Syntax Warning in cmake code at

/home/ubuntu/roscuda/build/roscuda_basic/CMakeFiles/CUDASampLib.dir/src/CUDASampLib_generated_basic.cu.o.cmake:79:218

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) in CUDASampLib_generated_basic.cu.o.cmake:
Syntax Warning in cmake code at

/home/ubuntu/roscuda/build/roscuda_basic/CMakeFiles/CUDASampLib.dir/src/CUDASampLib_generated_basic.cu.o.cmake:79:263

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) in CUDASampLib_generated_basic.cu.o.cmake:
Syntax Warning in cmake code at

/home/ubuntu/roscuda/build/roscuda_basic/CMakeFiles/CUDASampLib.dir/src/CUDASampLib_generated_basic.cu.o.cmake:79:302

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) in CUDASampLib_generated_basic.cu.o.cmake:
Syntax Warning in cmake code at

/home/ubuntu/roscuda/build/roscuda_basic/CMakeFiles/CUDASampLib.dir/src/CUDASampLib_generated_basic.cu.o.cmake:79:352

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) in CUDASampLib_generated_basic.cu.o.cmake:
Syntax Warning in cmake code at

/home/ubuntu/roscuda/build/roscuda_basic/CMakeFiles/CUDASampLib.dir/src/CUDASampLib_generated_basic.cu.o.cmake:79:414

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) in CUDASampLib_generated_basic.cu.o.cmake:
Syntax Warning in cmake code at

/home/ubuntu/roscuda/build/roscuda_basic/CMakeFiles/CUDASampLib.dir/src/CUDASampLib_generated_basic.cu.o.cmake:79:532

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) in CUDASampLib_generated_basic.cu.o.cmake:
Syntax Warning in cmake code at

/home/ubuntu/roscuda/build/roscuda_basic/CMakeFiles/CUDASampLib.dir/src/CUDASampLib_generated_basic.cu.o.cmake:79:621

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) in CUDASampLib_generated_basic.cu.o.cmake:
Syntax Warning in cmake code at

/home/ubuntu/roscuda/build/roscuda_basic/CMakeFiles/CUDASampLib.dir/src/CUDASampLib_generated_basic.cu.o.cmake:79:675

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) in CUDASampLib_generated_basic.cu.o.cmake:
Syntax Warning in cmake code at

/home/ubuntu/roscuda/build/roscuda_basic/CMakeFiles/CUDASampLib.dir/src/CUDASampLib_generated_basic.cu.o.cmake:79:733

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

– Removing /home/ubuntu/roscuda/build/roscuda_basic/CMakeFiles/CUDASampLib.dir/src/./CUDASampLib_generated_basic.cu.o
/usr/bin/cmake -E remove /home/ubuntu/roscuda/build/roscuda_basic/CMakeFiles/CUDASampLib.dir/src/./CUDASampLib_generated_basic.cu.o
– Generating dependency file: /home/ubuntu/roscuda/build/roscuda_basic/CMakeFiles/CUDASampLib.dir/src/CUDASampLib_generated_basic.cu.o.NVCC-depend
/usr/local/cuda-8.0/bin/nvcc -M -D__CUDACC__ /home/ubuntu/roscuda/src/roscuda_basic/src/basic.cu -o /home/ubuntu/roscuda/build/roscuda_basic/CMakeFiles/CUDASampLib.dir/src/CUDASampLib_generated_basic.cu.o.NVCC-depend -ccbin /usr/bin/cc -m64 -DROS_BUILD_SHARED_LIBS=1 -DROS_PACKAGE_NAME="roscuda_basic" -DROSCONSOLE_BACKEND_LOG4CXX -DvtkFiltersFlowPaths_AUTOINIT=1 ( vtkFiltersParallelFlowPaths ) -DvtkIOExodus_AUTOINIT=1 ( vtkIOParallelExodus ) -DvtkIOGeometry_AUTOINIT=1 ( vtkIOMPIParallel ) -DvtkIOImage_AUTOINIT=1 ( vtkIOMPIImage ) -DvtkIOSQL_AUTOINIT=2 ( vtkIOMySQL,vtkIOPostgreSQL ) -DvtkRenderingContext2D_AUTOINIT=1 ( vtkRenderingContextOpenGL ) -DvtkRenderingCore_AUTOINIT=4 ( vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL ) -DvtkRenderingFreeType_AUTOINIT=2 ( vtkRenderingFreeTypeFontConfig,vtkRenderingMatplotlib ) -DvtkRenderingLIC_AUTOINIT=1 ( vtkRenderingParallelLIC ) -DvtkRenderingVolume_AUTOINIT=1 ( vtkRenderingVolumeOpenGL ) -Dqh_QHpointer -Xcompiler ,"-g" -arch=compute_30 -DNVCC -I/usr/local/cuda-8.0/include -I/usr/include -I/usr/include/vtk-6.2 -I/usr/include/jsoncpp -I/usr/include/x86_64-linux-gnu -I/usr/lib/openmpi/include/openmpi/opal/mca/event/libevent2021/libevent -I/usr/lib/openmpi/include/openmpi/opal/mca/event/libevent2021/libevent/include -I/usr/lib/openmpi/include -I/usr/lib/openmpi/include/openmpi -I/usr/include/freetype2 -I/usr/include/x86_64-linux-gnu/freetype2 -I/usr/include/hdf5/openmpi -I/usr/include/libxml2 -I/usr/include/tcl -I/usr/include/python2.7 -I/opt/ros/kinetic/include -I/opt/ros/kinetic/share/xmlrpcpp/cmake/…/…/…/include/xmlrpcpp -I/usr/local/cuda-8.0/include
nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified
CMake Error at CUDASampLib_generated_basic.cu.o.cmake:207 (message):
Error generating
/home/ubuntu/roscuda/build/roscuda_basic/CMakeFiles/CUDASampLib.dir/src/./CUDASampLib_generated_basic.cu.o

roscuda_basic/CMakeFiles/CUDASampLib.dir/build.make:182: recipe for target ‘roscuda_basic/CMakeFiles/CUDASampLib.dir/src/CUDASampLib_generated_basic.cu.o’ failed
make[2]: *** [roscuda_basic/CMakeFiles/CUDASampLib.dir/src/CUDASampLib_generated_basic.cu.o] Error 1
CMakeFiles/Makefile2:377: recipe for target ‘roscuda_basic/CMakeFiles/CUDASampLib.dir/all’ failed
make[1]: *** [roscuda_basic/CMakeFiles/CUDASampLib.dir/all] Error 2
Makefile:138: recipe for target ‘all’ failed
make: *** [all] Error 2
Invoking “make -j8 -l8” failed

Hi,

Please check if there is some sort of verbose option so you can see what CMake is generating by way of commands to nvcc:
[url]CMake Wiki has moved

Thanks

I have compiled CUDA successfully on ROS(just CUDA code). Only when I add PCL to the Cmakelist.txt,He failed to compile.

Hi,

From your error message, we guess it’s caused by incorrect include/link directory.
Please try the suggestion in comment #4 to enable more cmake log for information.

Thanks.

Hi,

I’m suffering from the same problem nowadays.:(

Did you fix the problem? If yes, I would appreciate if you let me know how.

Thanks.

Hi,

Could you share more information about your error?

If you are finding a solution of this error:

nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified

Please check this topic for information:
https://devtalk.nvidia.com/default/topic/829306/cuda-programming-and-performance/-solved-nvcc-fatal-a-single-input-file-is-required-for-a-non-link-phase-when-an-outputfile-is-s/post/4519812/#4519812

Thanks.