MantisBT - CMake
View Issue Details
0016027CMakeModulespublic2016-03-21 17:062016-06-10 14:21
Eyal Rozenberg 
Brad King 
normalminorsometimes
closedfixed 
CMake 3.5 
CMake 3.5.1CMake 3.5.1 
0016027: nvcc encloses -ccbin argument with gratuitous quotation marks during intermediate-link phase
I've been using CMake on Debian Stretch with CUDA. I'm not sure what the version was until recently, but everything worked fine for me. Then I started getting errors such as:

"/usr/local/cuda/bin/gcc": No such file or directory
CMakeFiles/tester.dir/build.make:2335: recipe for target 'CMakeFiles/wherever/foo.o' failed

The culprit seems to be /usr/share/cmake/Modules/FindCUDA.cmake, line 1554. Pseudo-patch:

- list(APPEND nvcc_flags -ccbin "\"${CUDA_HOST_COMPILER}\"")
+ list(APPEND nvcc_flags -ccbin "${CUDA_HOST_COMPILER}")

that resolves the issue.
1. export CC=/link/to/your/appropriate/gcc
2. cmake a project with CMakeList.txt which finds CUDA and with set(CUDA_SEPARABLE_COMPILATION ON)
3. Build the project

The .cu files will compile, the intermediate-link phase won't pass
No tags attached.
has duplicate 0016031closed  FindCUDA.cmake - CUDA_SEPARABLE_COMPILATION fails because of escape character 
Issue History
2016-03-21 17:06Eyal RozenbergNew Issue
2016-03-22 11:06Brad KingNote Added: 0040745
2016-03-22 11:21Eyal RozenbergNote Added: 0040747
2016-03-22 11:29Brad KingNote Added: 0040748
2016-03-22 13:35Brad KingRelationship addedhas duplicate 0016031
2016-03-22 13:37Brad KingNote Added: 0040751
2016-03-23 14:47Brad KingNote Added: 0040757
2016-03-23 14:47Brad KingAssigned To => Brad King
2016-03-23 14:47Brad KingStatusnew => resolved
2016-03-23 14:47Brad KingResolutionopen => fixed
2016-03-23 14:47Brad KingFixed in Version => CMake 3.5.1
2016-03-23 14:47Brad KingTarget Version => CMake 3.5.1
2016-03-23 15:12Eyal RozenbergNote Added: 0040758
2016-06-10 14:21Kitware RobotNote Added: 0041213
2016-06-10 14:21Kitware RobotStatusresolved => closed

Notes
(0040745)
Brad King   
2016-03-22 11:06   
Thanks. Please try this fix:

FindCUDA: Fix regression in separate compilation
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=72a97b7a [^]
(0040747)
Eyal Rozenberg   
2016-03-22 11:21   
Brad, glancing at the patch, this will most probably work for me since I don't use MSVC, but - will it really work users who do? Are you sure you've not just narrowed the problem?
(0040748)
Brad King   
2016-03-22 11:29   
Re 0016027:0040747: What happened between CMake 3.4 and 3.5 is there was a bug report complaining that certain source/build tree names could not be used because the generated custom commands would not quote their names correctly. To fix this the VERBATIM option was added to our add_custom_command call. When that was done the explicit quoting on the line in question here should have been removed because the VERBATIM option will take care of it. Then it turned out that the special $(VCInstallDir) syntax could not be used in combination with VERBATIM so we added a special case to not use VERBATIM if that value appears. The patch I linked in 0016027:0040745 accounts for both possibilities.
(0040751)
Brad King   
2016-03-22 13:37   
The main reason these regressions appeared is that no one has ever set up testing infrastructure for the FindCUDA module. If anyone is interested in doing this, please come to the dev list:

 https://cmake.org/mailman/listinfo/cmake-developers [^]
(0040757)
Brad King   
2016-03-23 14:47   
The fix in 0016027:0040745 has been queued for merge to 'release' for inclusion in CMake 3.5.1.
(0040758)
Eyal Rozenberg   
2016-03-23 15:12   
Ok by me. I'm afraid I won't have time to devote to helping you with testing, though. I can promise to complain if you break something and it makes it to my distro...
(0041213)
Kitware Robot   
2016-06-10 14:21   
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.