Skip to content

CUDA detection reports "CUDA not found" when nvcc fails due unsupported host GCC #5152

@VenRoot

Description

@VenRoot

Is there an existing issue for this?

  • I have searched the existing issues

Is your issue described in the documentation?

  • I have read the documentation

Is your issue present in the latest beta/pre-release?

This issue is present in the latest pre-release

Describe the Bug

On Arch Linux, building Sunshine with CUDA enabled fails with:

-- Looking for a CUDA compiler
-- Looking for a CUDA compiler - NOTFOUND
CMake Error at cmake/compile_definitions/linux.cmake:62 (message):
CUDA not found.

If this is intentional, set '-DSUNSHINE_ENABLE_CUDA=OFF' or '-DCUDA_FAIL_ON_MISSING=OFF'

However CUDA is installed and nvcc exists:

/opt/cuda/bin/nvcc
Cuda compilation tools, release 13.2, V13.2.78

The actual failure in CMakeConfigureLog.yaml is that nvcc invokes the system GCC 16 host compiler:

Compiler: /opt/cuda/bin/nvcc
"/usr/bin"/g++ ...
--gnu_version=160101
/usr/include/c++/16.1.1/type_traits: error: identifier "char8_t" is undefined

Arch’s cuda 13.2.1-3 depends on gcc15, and the check succeeds when CMake/nvcc are given:

-DCMAKE_CUDA_COMPILER=/opt/cuda/bin/nvcc
-DCMAKE_CUDA_HOST_COMPILER=/usr/bin/g++-15

Expected Behavior

If check_language(CUDA) fails because nvcc cannot compile with the selected host compiler, the error should mention that CUDA was found but the CUDA compiler test failed, and suggest setting CMAKE_CUDA_HOST_COMPILER / CUDAHOSTCXX.

Actual behavior

The build reports only CUDA not found, which makes it look like the CUDA toolkit is missing.

Additional Context

Environment

  • Distro: Garuda Linux (Arch)
  • Sunshine: 2026.518.24409.r3.g3a19637
  • CUDA package: cuda 13.2.1-3
  • Default GCC: gcc 16.1.1
  • CUDA-compatible GCC installed: gcc15 15.2.1
  • nvcc: /opt/cuda/bin/nvcc, CUDA 13.2.78

Workaround

Passing the CUDA compiler and host compiler explicitly fixes the build:

-DCMAKE_CUDA_COMPILER=/opt/cuda/bin/nvcc
-DCMAKE_CUDA_HOST_COMPILER=/usr/bin/g++-15

Host Operating System

Linux

Operating System Version

Garuda Linux Rolling - Linux 7.0.9

Architecture

amd64/x86_64

Package

Linux - AUR (Third Party)

GPU Type

NVIDIA

GPU Model

RTX 4090

GPU Driver/Mesa Version

595.71.05

Capture Method

None

Apps

Log output

Online logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions