If the gcc version being used is incompatible with cuda version, there will be errors such as:
[ 68%] Building NVCC (Device) object src/nvtt/CMakeFiles/cuda_compile_1.dir/cuda/cuda_compile_1_generated_CompressKernel.cu.o
/usr/include/c++/10.1.0/type_traits(1396): error: type name is not allowed
/usr/include/c++/10.1.0/type_traits(1396): error: type name is not allowed
/usr/include/c++/10.1.0/type_traits(1396): error: identifier "__is_same_as" is undefined
3 errors detected in the compilation of "/home/nick/Code/Git/github.com/nvidia-texture-tools/src/nvtt/cuda/CompressKernel.cu".
CMake Error at cuda_compile_1_generated_CompressKernel.cu.o.Release.cmake:280 (message):
Error generating file
/home/nick/Code/Git/github.com/nvidia-texture-tools/cmake-build-release/src/nvtt/CMakeFiles/cuda_compile_1.dir/cuda/./cuda_compile_1_generated_CompressKernel.cu.o
make[2]: *** [src/nvtt/CMakeFiles/nvtt.dir/build.make:85: src/nvtt/CMakeFiles/cuda_compile_1.dir/cuda/cuda_compile_1_generated_CompressKernel.cu.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:721: src/nvtt/CMakeFiles/nvtt.dir/all] Error 2
make: *** [Makefile:183: all] Error 2
See discussion on GitHub: CUDA Build error on Arch Linux and CUDA Compilers – nvcc compatibility chart.
This can be resolved by using an earlier version of GCC which is compatible with the CUDA version. In my example setting the following CMake variable resolved the issue:
-DCUDA_HOST_COMPILER=/usr/bin/gcc-9