[CMake] PCL+CUDA results in error: "nvcc fatal single input file is required" when compiled with Visual Studio 2015

Nospi at abwesend.de Nospi at abwesend.de
Thu Feb 2 04:40:44 EST 2017


Hi everyone,
I'd like to ask how to use find_package for PCL (http://pointclouds.org/) and CUDA in the same build. I get a fatal error from NVCC (see below) if i try.
To reproduce create a CMake file:
 
cmake_minimum_required(VERSION 3.4 FATAL_ERROR)
find_package(PCL 1.8 REQUIRED)
find_package(CUDA "8.0" REQUIRED)
cuda_add_library(cuda STATIC main.cu) # content of main.cu does not matter
 
 
 
Run cmake and compile with Visual Studio 2015.
For me this results in:
 
------ Build started: Project: cuda, Configuration: Release x64 ------
  Building NVCC (Device) object CMakeFiles/cuda.dir/Release/cuda_generated_main.cu.obj
  CMake Warning (dev) in cuda_generated_main.cu.obj.cmake:
    Syntax Warning in cmake code at
 
      <path>/CMakeFiles/cuda.dir/cuda_generated_main.cu.obj.cmake:79:146
 
    Argument not separated from preceding token by whitespace.
  This warning is for project developers.  Use -Wno-dev to suppress it.
 
  CMake Warning (dev) in cuda_generated_main.cu.obj.cmake:
    Syntax Warning in cmake code at
 
      <path>/CMakeFiles/cuda.dir/cuda_generated_main.cu.obj.cmake:79:402
 
    Argument not separated from preceding token by whitespace.
  This warning is for project developers.  Use -Wno-dev to suppress it.
 
  nvcc fatal   : A single input file is required for a non-link phase when an outputfile is specified
 
  CMake Error at cuda_generated_main.cu.obj.cmake:207 (message):
    Error generating
    <path>/CMakeFiles/cuda.dir//Release/cuda_generated_main.cu.obj
 
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(170,5): error MSB6006: "cmd.exe" exited with code 1.
 
 
 
I found this page (http://idav.ucdavis.edu/~anjul/cudaErrors.htm) in regard to the nvcc error, it says to avoid using quotations in the nvcc include directories. In my case the ${CUDA_INCLUDE_DIRS} variable does not contain any quotations marks.
I posted to PCL user's mailing list a while ago but had no responses (http://www.pcl-users.org/Including-pcl-in-CMake-causes-error-if-also-including-cuda-td4042597.html).
FWIW, I had the same error when using PCL 1.7, CUDA 8.0 and Visual Studio 2012.

Up to now I'm stuck with separating CUDA and PCL in my source. Since that is getting more and more inconvenient, I'd be grateful for any hint how to resolve this.

Best regards,
Peter


 


More information about the CMake mailing list