I'm trying to compile NVIDIA CUDA on a Fedora 24 Workstation.

I'm using CUDA version 7.5 and when I try to compile it I get this method:

gcc versions later than 4.9 are not supported!

I have installed:

gcc (GCC) (Red Hat 6.1.1-3).

How can I install gcc 4.9 on my machine?

My question is related to this one, but on that one doesn't tell how to install to different gcc versions on the same machine.

On ubuntu I can do it with this command:

sudo apt-get install gcc-4.9 g++-4.9

But I have a Fedora 24.

2 Answers 2


There are compat-gcc* packages providing older version of GCC on Fedora. You can find them in koji and install them using dnf (version 3.4):

dnf install compat-gcc-34
  • 1
    That's much, much too old. CUDA 7 supports GCC 4.9.x
    – einpoklum
    Mar 16, 2017 at 10:44

Devtoolset-2 provides g++-4.8.2 : # dnf install --nogpgcheck devtoolset-2-gcc-c++

Further INFO : Please read my post here https://stackoverflow.com/questions/37774923/downgrading-c-c-compiler-on-fedora-23-to-a-matlab-r2016a-compatible-compiler/37776358#37776358

And devtoolset-3 provides g++-4.9.2 . No repo for Fedora 24, but with no extra dependencies for these EL7 packages, they install easily. ... The four packages :


... are available as one package, devtoolset-3-gcc-c++_el7.tar https://drive.google.com/file/d/0B7S255p3kFXNeElrMmc0TTlYLWM/view?usp=sharing

Unpack, and

cd devtoolset-3-gcc-c++_el7/
# dnf install ./*

Be aware that the command scl enable devtoolset-3 bash enables gcc/g++ v4.9 in the current terminal session only.

EDIT : A copy of the CentOS7 repo files and the "key file" works perfect in Fedora 24. Just copy {CentOS-SCLo-scl-rh.repo, CentOS-SCLo-scl.repo} to /etc/yum.repos.d/, and RPM-GPG-KEY-CentOS-SIG-SCLo to /etc/pki/rpm-gpg/ .

Files, CentOS-SCLo-scl-el7.tar.gz https://drive.google.com/file/d/0B7S255p3kFXNSnR0TkJKbm5qMDQ/view?usp=sharing

Install : # dnf install devtoolset-3-gcc-c++


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .