如何在Fedora上安装旧版本的gcc [英] How to install an older version of gcc on Fedora

查看:176
本文介绍了如何在Fedora上安装旧版本的gcc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在Fedora 31上安装CUDA,但由于在CUDA正式支持Fedora 29(gcc 8.2)的情况下陷入了最后一步,而Fedora 31附带的版本是9.2,然后我安装了带有CUDA支持的Pytorch,这并不令人感到意外,不提供CUDA支持:

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:

>>> import torch
>>> device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
>>> device
device(type='cpu')

然后我尝试在 pkgs 上搜索gcc,g ++和gfortran,但陷入了依赖地狱,像这样:

I then tried to search for gcc, g++ and gfortran on pkgs, but got stuck in a dependency hell, something like:

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

我在上找到了很多有用的链接这篇文章,但不幸的是最新版本是gcc 7.3 我的最后一个选择是从源代码构建,但是除此之外,还有其他选择吗?我不确定我的计算机能否在相当长的时间内处理该编译.

I found a bunch helpful links on this post 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.

推荐答案

构建gcc-8.2.0

Build gcc-8.2.0

# dnf install gcc-c++ flex bison binutils-devel elfutils-devel elfutils-libelf-devel
tar xvf gcc-8.2.0.tar.xz 
cd gcc-8.2.0/
tar xvf mpfr-4.0.2.tar.xz && mv -v mpfr-4.0.2 mpfr
tar xvf gmp-6.1.2.tar.xz && mv -v gmp-6.1.2 gmp
tar xvf mpc-1.1.0.tar.gz && mv -v mpc-1.1.0 mpc
cd ../
mkdir build-gcc820
cd build-gcc820/
../gcc-8.2.0/configure --prefix=/usr/local/gcc82 --program-suffix=82 --enable-languages=c,c++,fortran --disable-multilib --disable-libstdcxx-pch
make 
# make install

结果:gcc82-c++-8.2.0-2.fc29.x86_64.rpm https://驱动器. google.com/file/d/1qGPvF9jc6CiI1a0-c3I4Zj4vxajEwSzc/view?usp=sharing 提供/usr/bin/{gcc8, g++8, gfortran8}

安装:# dnf install Downloads/gcc82-c++-8.2.0-2.fc29.x86_64.rpm

这篇关于如何在Fedora上安装旧版本的gcc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆