View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013674CMakeCMakepublic2012-11-09 13:192016-06-10 14:31
ReporterJames Shackleford 
Assigned ToKitware Robot 
PlatformLinuxOSUbuntuOS Version12.04 LTS
Product VersionCMake 
Target VersionFixed in Version 
Summary0013674: FindCUDA does not respect -ccbin or --compiler-bindir arguments
DescriptionFindCUDA/run_nvcc.cmake (lines 106--115) prevent manual specification of the compiler to be used by the Nvidia CUDA compiler nvcc via the -ccbin or --compiler-bindir arguments. The issue is to due the incorrect usage of LIST(FIND ...) to perform a substring search, resulting in a false negative.

As a result of the failed LIST(FIND ...), run_nvcc.cmake sets the preferred compiler to the system default gcc *AND* also passes the undetected manually specified gcc version. This results in nvcc failing due to a duplicate parameter specification for the external compiler.

Because nvcc is only compatible with a select few versions of gcc on Linux, the inability to set this parameter is an issue for users who do not use one of these Nvidia approved versions of gcc as their default compiler.
Steps To ReproduceFor example:

  set (CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --compiler-bindir=/usr/bin/gcc-4.4")

with result in

   nvcc fatal : redefinition of argument 'compiler-bindir'
Additional InformationI do not believe FindCUDA/run_nvcc.cmake (lines 106--115) are necessary. Removal of these offending lines seems to restore correct behavior for the cases:

[1] -ccbin parameter not specified
[2] -ccbin parameter specified
[3] --compiler-bindir parameter not specified
[4] --compiler-bindir parameter specified
TagsCMake, CUDA, FindCUDA, nvcc
Attached Filespatch file icon FindCUDA.patch [^] (802 bytes) 2012-11-09 13:19 [Show Content]


James Bigler (developer)
2012-11-11 00:22

What happens when you remove the equal sign?

And by the way CUDA_NVCC_FLAGS is a list and not a string like the CMAKE_C_FLAGS and CMAKE_CXX_FLAGS variables.

You should probably do something like:

list (APPEND CUDA_NVCC_FLAGS --compiler-bindir /usr/bin/gcc-4.4)

I might need to fix up the flag detection to accomodate for using the equal sign, but I want you to be able to make progress as well.

Alternatively with this version of FindCUDA you can now specify the host compiler to use directly:

# CUDA_HOST_COMPILER (Default CMAKE_C_COMPILER, $(VCInstallDir)/bin for VS)
# -- Set the host compiler to be used by nvcc. Ignored if -ccbin or
# --compiler-bindir is already present in the CUDA_NVCC_FLAGS or
# CUDA_NVCC_FLAGS_<CONFIG> variables. For Visual Studio targets
# $(VCInstallDir)/bin is a special value that expands out to the path when
# the command is run from withing VS.
domibel (reporter)
2013-08-26 15:14

Removing the equal sign helped in my case.
Michele Mastropietro (reporter)
2015-06-04 11:09

Please see [^]

For me the double `--ccbin` option inclusion is resolved with the patch attached.
Kitware Robot (administrator)
2016-06-10 14:28

Resolving issue as `moved`.

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.

 Issue History
Date Modified Username Field Change
2012-11-09 13:19 James Shackleford New Issue
2012-11-09 13:19 James Shackleford File Added: FindCUDA.patch
2012-11-09 13:21 James Shackleford Tag Attached: CMake
2012-11-09 13:21 James Shackleford Tag Attached: CUDA
2012-11-09 13:22 James Shackleford Tag Attached: FindCUDA
2012-11-09 13:22 James Shackleford Tag Attached: nvcc
2012-11-11 00:22 James Bigler Note Added: 0031522
2013-08-26 15:14 domibel Note Added: 0033748
2015-06-04 11:09 Michele Mastropietro Note Added: 0038884
2016-06-10 14:28 Kitware Robot Note Added: 0042147
2016-06-10 14:28 Kitware Robot Status new => resolved
2016-06-10 14:28 Kitware Robot Resolution open => moved
2016-06-10 14:28 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed

Copyright © 2000 - 2018 MantisBT Team