Always stops while compiling CUDA with CMAKE_CUDA_LAUNCHER environment var
Author: NoelJacobCreated Aug 28, 2026Updated Aug 28, 2026
The build always fail when building CUDA with CMAKE_CUDA_LAUNCHER environment variable set. I have also set other environment variables for C and CPP but they work fine. I figured this out while compiling llama.cpp. Here is the error message while compiling a sample CUDA hello world program with CMAKE:
cmake .-- The CUDA compiler identification is NVIDIA 13.3.73 with host compiler GNU 15.3.0
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - failed
-- Check for working CUDA compiler: /opt/cuda/bin/nvcc
-- Check for working CUDA compiler: /opt/cuda/bin/nvcc - broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCUDACompiler.cmake:70 (message):
The CUDA compiler
"/opt/cuda/bin/nvcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: '/tmp/untitledcuda/CMakeFiles/CMakeScratch/TryCompile-bXs3gZ'
Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_0c617/fast
/usr/bin/make -f CMakeFiles/cmTC_0c617.dir/build.make CMakeFiles/cmTC_0c617.dir/build
make[1]: Entering directory '/tmp/untitledcuda/CMakeFiles/CMakeScratch/TryCompile-bXs3gZ'
Building CUDA object CMakeFiles/cmTC_0c617.dir/main.cu.o
sccache /opt/cuda/bin/nvcc -forward-unknown-to-host-compiler "--generate-code=arch=compute_75,code=[compute_75,sm_75]" -MD -MT CMakeFiles/cmTC_0c617.dir/main.cu.o -MF CMakeFiles/cmTC_0c617.dir/main.cu.o.d -x cu -c /tmp/untitledcuda/CMakeFiles/CMakeScratch/TryCompile-bXs3gZ/main.cu -o CMakeFiles/cmTC_0c617.dir/main.cu.o
fatbinary fatal : Could not open input file 'main.ptx'
sccache: Compiler killed by signal 1
make[1]: *** [CMakeFiles/cmTC_0c617.dir/build.make:82: CMakeFiles/cmTC_0c617.dir/main.cu.o] Error 254
make[1]: Leaving directory '/tmp/untitledcuda/CMakeFiles/CMakeScratch/TryCompile-bXs3gZ'
make: *** [Makefile:134: cmTC_0c617/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!Source: mozilla/sccache