catkin and cuda_add_library

asked 2013-12-11 14:09:39 -0600

aswin gravatar image

updated 2013-12-11 22:50:24 -0600

Hi, I have the following error when I try to build a *.cu file using cuda_add_library. cuda_add_library works fine on normal cpp files though.

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

Portion of my verbose build is below. It seems like the nvcc build string for is wrong. The same for so3.cpp looks fine. I have no problems on rosbuild though.

[ 30%] Building CXX object CMakeFiles/so_phus.dir/src/so_phus/so3.cpp.o
**/usr/bin/c++   -DBT_USE_DOUBLE_PRECISION -DCUDA_BUILD -DROS_PACKAGE_NAME=\"dwo_slam\" -Dso_phus_EXPORTS -O3 -fPIC -I/usr/local/include/opencv -I/usr/local/include -I/home/hope/Dropbox/office/catkin_ws/src/dwo_slam/include -I/opt/ros/hydro/include -I/opt/ros/hydro/include/opencv -I/usr/include/eigen3 -I/usr/include/suitesparse -I/home/hope/svslocal/include -I/usr/local/cuda/include -I/usr/local/cuda-5.5/include    -o CMakeFiles/so_phus.dir/src/so_phus/so3.cpp.o -c /home/hope/Dropbox/office/catkin_ws/src/dwo_slam/src/so_phus/so3.cpp
Linking CXX shared library devel/lib/**
/usr/bin/cmake -E cmake_link_script CMakeFiles/so_phus.dir/link.txt --verbose=1
/usr/bin/c++  -fPIC -O3   -shared -Wl,-soname, -o devel/lib/ CMakeFiles/so_phus.dir/src/so_phus/se3.cpp.o CMakeFiles/so_phus.dir/src/so_phus/so3.cpp.o /usr/local/cuda-5.5/lib64/ -lcuda -Wl,-rpath,/usr/local/cuda-5.5/lib64 

[ 38%] Building NVCC (Device) object ./
/usr/bin/cmake -E make_directory /home/hope/Dropbox/office/catkin_ws/src/dwo_slam/.
/usr/bin/cmake -D verbose:BOOL=1 -D build_configuration:STRING= -D generated_file:STRING=/home/hope/Dropbox/office/catkin_ws/src/dwo_slam/./ -D generated_cubin_file:STRING=/home/hope/Dropbox/office/catkin_ws/src/dwo_slam/./ -P /home/hope/Dropbox/office/catkin_ws/src/dwo_slam/CMakeFiles/
-- Removing /home/hope/Dropbox/office/catkin_ws/src/dwo_slam/./
/usr/bin/cmake -E remove /home/hope/Dropbox/office/catkin_ws/src/dwo_slam/./
-- Generating dependency file: /home/hope/Dropbox/office/catkin_ws/src/dwo_slam/CMakeFiles/
**/usr/local/cuda-5.5/bin/nvcc -M -D__CUDACC__ /home/hope/Dropbox/office/catkin_ws/src/dwo_slam/src/ -o /home/hope/Dropbox/office/catkin_ws/src/dwo_slam/CMakeFiles/ -m64 -DROS_PACKAGE_NAME= dwo_slam\" -DCUDA_BUILD -DBT_USE_DOUBLE_PRECISION -DdwoSLAM_EXPORTS\" -Xcompiler ,\"-O3\",\"-fPIC\",\"-g\" -arch=sm_20 --use_fast_math -O3 -DNVCC -I/usr/local/cuda-5.5/include -I/usr/local/include/opencv -I/usr/local/include -I/home/hope/Dropbox/office/catkin_ws/src/dwo_slam/include -I/opt/ros/hydro/include -I/opt/ros/hydro/include/opencv -I/usr/include -I/usr/include/eigen3 -I/usr/include/suitesparse -I/home/hope/svslocal/include -I/usr/local/cuda/include -I/usr/local/cuda-5.5/include**
nvcc fatal   : A single input file is required for a non-link phase when an outputfile is specified
CMake Error at CMakeFiles/ (message):
  Error generating

If I type in the ... (more)

edit retag flag offensive close merge delete


It would be helpful to see your CMakeLists.txt

William gravatar image William  ( 2013-12-11 16:38:44 -0600 )edit
aswin gravatar image aswin  ( 2013-12-11 19:17:54 -0600 )edit

Could you perhaps include the contents of the file in your original question? The dropbox link is 404-ing for me.

gvdhoorn gravatar image gvdhoorn  ( 2013-12-11 22:01:42 -0600 )edit

updated in question

aswin gravatar image aswin  ( 2013-12-11 22:42:23 -0600 )edit

I don't see anything in particular that could be the problem, I would suggest printing out the variables in your library for loops you have and checking that they are all sane. I can't imagine what/how catkin could be interfering in this scenario.

William gravatar image William  ( 2013-12-12 10:13:50 -0600 )edit

I can compile the package with exact same options and code in rosbuild with no problem.

aswin gravatar image aswin  ( 2013-12-12 22:47:24 -0600 )edit

Have you tried: cuda_compile( DENSE_TRACKING_O src/ ) cuda_add_library(dwoSLAM src/ src/ ${DENSE_TRACKING_O} ) Worked for me, while adding all files to

Wolf gravatar image Wolf  ( 2014-01-06 19:40:04 -0600 )edit