title: How to install an older version of gcc on Fedora
body: <p>I tried to install CUDA on Fedora 31 but got stuck at the last step because CUDA officially supports Fedora 29 (gcc 8.2) while the version shipped with Fedora 31 is 9.2, I then installed Pytorch with CUDA support and without much surprise, CUDA support is not present:</p>
  <pre class="lang-py prettyprint-override"><code>&gt;&gt;&gt; import torch
  &gt;&gt;&gt; device = torch.device(&quot;cuda&quot; if torch.cuda.is_available() else &quot;cpu&quot;)
  &gt;&gt;&gt; device
  device(type='cpu')
  </code></pre>
  <p>I then tried to search for gcc, g++ and gfortran on <a href="https://pkgs.org/" rel="noreferrer">pkgs</a>, but got stuck in a dependency hell, something like:</p>
  <pre class="lang-sh prettyprint-override"><code>sudo dnf install gcc-8.2.1-2.fc29.x86_64.rpm gcc-gfortran-8.2.1-2.fc29.x86_64.rpm gcc-c++-8.2.1-2.fc29.x86_64.rpm -y
  
  Error: 
   Problem 1: conflicting requests
    - nothing provides cpp = 8.2.1-2.fc29 needed by gcc-8.2.1-2.fc29.x86_64
    - nothing provides libgomp = 8.2.1-2.fc29 needed by gcc-8.2.1-2.fc29.x86_64
   Problem 2: conflicting requests
    - nothing provides libgfortran = 8.2.1-2.fc29 needed by gcc-gfortran-8.2.1-2.fc29.x86_64
    - nothing provides libquadmath = 8.2.1-2.fc29 needed by gcc-gfortran-8.2.1-2.fc29.x86_64
    - nothing provides libquadmath-devel = 8.2.1-2.fc29 needed by gcc-gfortran-8.2.1-2.fc29.x86_64
   Problem 3: conflicting requests
    - nothing provides libstdc++ = 8.2.1-2.fc29 needed by gcc-c++-8.2.1-2.fc29.x86_64
    - nothing provides libstdc++-devel = 8.2.1-2.fc29 needed by gcc-c++-8.2.1-2.fc29.x86_64
  </code></pre>
  <p>I found a bunch helpful links on <a href="https://stackoverflow.com/questions/47175706/how-to-install-gcc-4-9-2-on-rhel-7-4">this post</a> but unfortunately the last version is gcc 7.3
  My last option is building from source, but apart from that is there any other option? I'm not sure my computer can handle the compilation in a decent amount of time.</p>