catkin and cuda_add_library
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 DenseTracking.cu 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/libso_phus.so**
/usr/bin/cmake -E cmake_link_script CMakeFiles/so_phus.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC -O3 -shared -Wl,-soname,libso_phus.so -o devel/lib/libso_phus.so 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/libcudart.so -lcuda -Wl,-rpath,/usr/local/cuda-5.5/lib64
[ 38%] Building NVCC (Device) object ./dwoSLAM_generated_DenseTracking.cu.o
/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/./dwoSLAM_generated_DenseTracking.cu.o -D generated_cubin_file:STRING=/home/hope/Dropbox/office/catkin_ws/src/dwo_slam/./dwoSLAM_generated_DenseTracking.cu.o.cubin.txt -P /home/hope/Dropbox/office/catkin_ws/src/dwo_slam/CMakeFiles/dwoSLAM_generated_DenseTracking.cu.o.cmake
-- Removing /home/hope/Dropbox/office/catkin_ws/src/dwo_slam/./dwoSLAM_generated_DenseTracking.cu.o
/usr/bin/cmake -E remove /home/hope/Dropbox/office/catkin_ws/src/dwo_slam/./dwoSLAM_generated_DenseTracking.cu.o
-- Generating dependency file: /home/hope/Dropbox/office/catkin_ws/src/dwo_slam/CMakeFiles/dwoSLAM_generated_DenseTracking.cu.o.NVCC-depend
**/usr/local/cuda-5.5/bin/nvcc -M -D__CUDACC__ /home/hope/Dropbox/office/catkin_ws/src/dwo_slam/src/DenseTracking.cu -o /home/hope/Dropbox/office/catkin_ws/src/dwo_slam/CMakeFiles/dwoSLAM_generated_DenseTracking.cu.o.NVCC-depend -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/dwoSLAM_generated_DenseTracking.cu.o.cmake:198 (message):
Error generating
/home/hope/Dropbox/office/catkin_ws/src/dwo_slam/./dwoSLAM_generated_DenseTracking.cu.o
If I type in the ...
It would be helpful to see your CMakeLists.txt
Thank you for the edit! CMakelists - https://dl.dropboxusercontent.com/u/8948006/CMakeLists.txt
Could you perhaps include the contents of the file in your original question? The dropbox link is 404-ing for me.
updated in question
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.
I can compile the package with exact same options and code in rosbuild with no problem.
Have you tried: cuda_compile( DENSE_TRACKING_O src/DenseTracking.cu ) cuda_add_library(dwoSLAM src/DenseTracker.cc src/Frontend.cc ${DENSE_TRACKING_O} ) Worked for me, while adding all files to