I try to build a project which uses CUDA
. The CUDA
on my machine is the newest 9.1
. The following error is reported:
In file included from /opt/cuda/include/host_config.h:50:0,
from /opt/cuda/include/cuda_runtime.h:78,
from <command-line>:0:
/opt/cuda/include/crt/host_config.h:121:2: error: #error -- unsupported GNU version! gcc versions later than 6 are not supported!
#error -- unsupported GNU version! gcc versions later than 6 are not supported!
^~~~~
Check /opt/cuda/include/crt/host_config.h
:
#if __GNUC__ > 6
#error -- unsupported GNU version! gcc versions later than 6 are not supported!
#endif /* __GNUC__ > 6 */
The solution is to specify the gcc-6
compiler during running cmake
command:
# cmake -DCMAKE_C_COMPILER=gcc-6 -DCMAKE_CXX_COMPILER=g++-6 ..
The reference is here.