Skip to content

Always stops while compiling CUDA with CMAKE_CUDA_LAUNCHER environment var #2828

Open

Description

@NoelJacob

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!

Activity

  1. NoelJacob commented on Aug 28, 2026

    @NoelJacob
    Author

    Test file I used to build:

    // main.cu
    #include <iostream>
    
    int main() {
        std::cout << "Hello, World!" << std::endl;
        return 0;
    }
    #CMakeLists.txt
    cmake_minimum_required(VERSION 4.3)
    project(untitledcuda CUDA)
    
    set(CMAKE_CUDA_STANDARD 20)
    
    add_executable(untitledcuda main.cu)
    
    set_target_properties(untitledcuda PROPERTIES
            CUDA_SEPARABLE_COMPILATION ON)
  2. added a commit that references this issue on Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions