Using GCC 15 for nvcc on Fedora 44

Hello. I updated today my Fedora system to 44, and my GCC version upgraded to 16. I’m not being able to compile anything with nvcc now since GCC 16 is still unsupported. Is there a way to use my GCC 15? I tried using --compiler-bindir /usr/bin/gcc-15 (after installing gcc-15), but I still get errors.

Thanks for the attention.

Vinicius.

Hey! I ran into the exact same issue on Fedora 44 with GCC 16. The gcc15 workaround won’t help unfortunately, the incompatibility runs deeper than just the version gate. GCC 14+ <type_traits> uses new built-in keywords like __is_array and __is_pointer that nvcc’s host compiler frontend simply doesn’t understand, so --allow-unsupported-compiler bypasses the check but the compilation still fails.

What worked for me was distrobox. Fedora 39 ships GCC 13 which CUDA 12.x is happy with, and the container shares your home directory and GPU so you don’t need to copy anything around.

sudo dnf install distrobox podman
distrobox create --name cuda-dev --image fedora:39
distrobox enter cuda-dev

Then inside the container:

sudo dnf install gcc gcc-c++
sudo dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/fedora39/x86_64/cuda-fedora39.repo
sudo dnf install cuda-toolkit

From there you can compile and run CUDA code normally. Your host Fedora 44 stays untouched.

NVIDIA will need to ship a newer toolkit to officially support GCC 14+. Until then this is the path of least resistance!

BTW current versions of compilers for Fedora 44 are:

gcc (GCC) 16.1.1 20260515 (Red Hat 16.1.1-2)

clang.x86_64 22.1.8-1.fc44

Cuda 13.3 Update 1 supports F44 but with gcc 15.2.1 (actually15.x), clang 21.x as far as I can see

If you need CUDA to work in a Python environment (which is quite likely to happen), you can install CUDA via conda/mamba:

conda install conda-forge::cuda-toolkit
# mamba install conda-forge::cuda-toolkit # If using mamba

If you are not a fan of conda/mamba, pip/uv installation is also possible via PyTorch. You can also check out uv’s guide on installing PyTorch.


If you still want a “real” system-wide installation, I think it’s still possible. You’ve probably already installed the cuda-toolkit. I think all you need to do is:

export NVCC_CCBIN='g++-15'

before you compile anything using nvcc. You can add that to your profile or .bashrc.

Likewise, if you want to test out cuda-samples, you need to tell cmake to use gcc-15:

cd cuda-samples
# rm -rf build/ # If you have built before
mkdir build && cd build
cmake .. \
  -DCMAKE_C_COMPILER=/usr/bin/gcc-15 \
  -DCMAKE_CXX_COMPILER=/usr/bin/g++-15

After the above steps, I’m able to get cuda-samples built and running. I’m using aarch64 Fedora 44, 595.84 driver, and CUDA 13.2.1.