slaanesh/cuda-gcc

Project ID: 18340

Description

Compatibility package for running GCC on Fedora. Required for current CUDA packages. This tracks the current CUDA release and the current Fedora releases when an incompatibility arises.

https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#host-compiler-support-policy

Installation Instructions

When running the CUDA stack on a recent Fedora distribution, you’re very likely to hit the compatibility issue with the current GCC release not being yet supported by NVCC. This is quite easy to address, but not many people seem to know it.

Since a few years I’ve been shipping a cuda-gcc package which appears as a drop in replacement for NVCC. It can be installed along with CUDA and the drivers to run the upstream CUDA packages provided by Nvidia.

Originally it was a custom built GCC, but now this package now simply uses the compatibility GCC package provided by Fedora:

$ sudo dnf install cuda-gcc Updating and loading repositories: Repositories loaded. Package Arch Version Repository Size Installing: cuda-gcc noarch 13.3.1-1.fc41 fedora-multimedi 244.0 B Installing dependencies: gcc13 x86_64 13.3.1-2.fc41.1 fedora 104.5 MiB gcc13-c++ x86_64 13.3.1-2.fc41.1 fedora 55.0 MiB Transaction Summary: Installing: 3 packages

And then sets the necessary environment variable to override the NVCC detected GCC binary:

$ cat /etc/profile.d/cuda-gcc.sh export NVCC_CCBIN='g++-13' # Alternatively you can use the following: export NVCC_PREPEND_FLAGS='-ccbin /usr/bin/g++-13'

Logout/login or reload your profile and you’re good to go.

This way, every time you invoke NVCC you are not using the system compiler but the one provided by the cuda-gcc package.

On a Red Hat Enterprise Linux based distribution you can achieve the same result by installing the development toolset of your choice and activating the environment for it. This is usually not an issue as NVCC is officially supported on those distributions.

Active Releases

The following unofficial repositories are provided as-is by owner of this project. Contact the owner directly for bugs or issues (IE: not bugzilla).

Release Architectures Repo Download
Fedora 40 aarch64 (181)*, ppc64le (60)*, x86_64 (784)* Fedora 40 (293 downloads)
Fedora 41 aarch64 (140)*, ppc64le (20)*, x86_64 (401)* Fedora 41 (66 downloads)
Fedora rawhide aarch64 (231)*, ppc64le (102)*, x86_64 (235)* Fedora rawhide (221 downloads)

* Total number of downloaded packages.