GCC 4.9版没有安装候选版本

问题描述 投票:0回答:1

我正在尝试在Ubuntu上安装gcc 4.9版本以替换当前版本7.5(因为Torch与版本6及更高版本不兼容)。但是,即使遵循确切的说明,我也无法安装它。我做了:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo aot-get remove gcc
sudo apt-get install gcc-4.9.

注意,我已经安装了CUDA。当我尝试安装4.9版时,它显示以下信息:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'gcc-4.9-hppa-linux-gnu' for regex 'gcc-4.9.'
Note, selecting 'gcc-4.9-m68k-linux-gnu' for regex 'gcc-4.9.'
Note, selecting 'gcc-4.9-sh4-linux-gnu' for regex 'gcc-4.9.'
Note, selecting 'gcc-4.9-mips64el-linux-gnuabi64' for regex 'gcc-4.9.'
Note, selecting 'gcc-4.9-aarch64-linux-gnu' for regex 'gcc-4.9.'
Note, selecting 'gcc-4.9-hppa64' for regex 'gcc-4.9.'
Note, selecting 'gcc-4.9-sparc-linux-gnu' for regex 'gcc-4.9.'
Note, selecting 'gcc-4.9-powerpc-linux-gnuspe' for regex 'gcc-4.9.'
Note, selecting 'gcc-4.9-s390x-linux-gnu' for regex 'gcc-4.9.'
Note, selecting 'gcc-4.9-arm-linux-gnueabihf' for regex 'gcc-4.9.'
Note, selecting 'gcc-4.9-mips64-linux-gnuabi64' for regex 'gcc-4.9.'
Note, selecting 'gcc-4.9-powerpc64le-linux-gnu' for regex 'gcc-4.9.'
Note, selecting 'gcc-4.9-powerpc-linux-gnu' for regex 'gcc-4.9.'
Note, selecting 'gcc-4.9-powerpc64-linux-gnu' for regex 'gcc-4.9.'
Note, selecting 'gcc-4.9-sparc64-linux-gnu' for regex 'gcc-4.9.'
Note, selecting 'gcc-4.9-mipsel-linux-gnu' for regex 'gcc-4.9.'
Note, selecting 'gcc-4.9-alpha-linux-gnu' for regex 'gcc-4.9.'
Note, selecting 'gcc-4.9-mips-linux-gnu' for regex 'gcc-4.9.'
Note, selecting 'gcc-4.9-arm-linux-gnueabi' for regex 'gcc-4.9.'
The following packages were automatically installed and are no longer required:
  cuda-cudart-10-2 cuda-cudart-dev-10-2 cuda-cufft-10-2 cuda-cufft-dev-10-2
  cuda-cuobjdump-10-2 cuda-curand-10-2 cuda-curand-dev-10-2 cuda-cusolver-10-2
  cuda-cusolver-dev-10-2 cuda-cusparse-10-2 cuda-cusparse-dev-10-2
  cuda-driver-dev-10-2 cuda-gdb-10-2 cuda-libraries-10-2
  cuda-libraries-dev-10-2 cuda-license-10-2 cuda-memcheck-10-2
  cuda-misc-headers-10-2 cuda-npp-10-2 cuda-npp-dev-10-2 cuda-nsight-10-2
  cuda-nsight-compute-10-2 cuda-nsight-systems-10-2 cuda-nvdisasm-10-2
  cuda-nvgraph-10-2 cuda-nvgraph-dev-10-2 cuda-nvjpeg-10-2
  cuda-nvjpeg-dev-10-2 cuda-nvml-dev-10-2 cuda-nvprof-10-2 cuda-nvprune-10-2
  cuda-nvrtc-10-2 cuda-nvrtc-dev-10-2 cuda-nvtx-10-2 cuda-nvvp-10-2
  cuda-sanitizer-api-10-2 cuda-visual-tools-10-2 freeglut3-dev g++-7
  libcublas-dev libcublas10 libnvidia-extra-440 libxi-dev libxmu-dev
  libxmu-headers libxt-dev nsight-compute-2019.5.0 nsight-systems-2019.5.2
  nvidia-compute-utils-440 nvidia-kernel-common-440 nvidia-kernel-source-440
  nvidia-modprobe nvidia-utils-440 xserver-xorg-video-nvidia-440
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

出于任何原因,它都不想安装它。另一方面,当我键入sudo apt-get install gcc时,它将重新安装7.5版。如何用4.9版替换GCC(和G ++)?

bash gcc g++ apt package-managers
1个回答
0
投票

同时,我想通了自己。但是,您必须添加,但奇怪的是,G ++和GCC 4.9版仍然不可用,必须使用4.8。通过组合多种资源,我构造了一种在计算机上安装G ++和GCC 4.8.5并将其配置为默认选项的方法:

# Remove old packages and install new ones
sudo apt-get remove gcc g++
sudo apt-get install gcc-4.8 g++-4.8 build-essential
# After this however, you can only access it with specifically calling for 'gcc-4.8' and 'g++-4.8'. So we set them default
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 10
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --set cc /usr/bin/gcc
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
sudo update-alternatives --set c++ /usr/bin/g++

当我们现在键入gcc --version时,我们得到:

gcc (Ubuntu 4.8.5-4ubuntu8) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
© www.soinside.com 2019 - 2024. All rights reserved.