Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fail to install gcc-4.9 in ubuntu17.04

Tags:

gcc

ubuntu

apt

While trying to build llvm 3.4 from source on Ubuntu 17.04, I have encountered some problems related to gcc 6.3 (described here), so I want to use gcc-4.9. However, when I run from terminal:

sudo apt install gcc-4.9 --fix-missing

I get the following error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
cpp-4.9 gcc-4.9-base libasan1 libcloog-isl4 libgcc-4.9-dev
Suggested packages:
gcc-4.9-locales gcc-4.9-multilib gcc-4.9-doc libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan1-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg
libcilkrts5-dbg libquadmath0-dbg
The following NEW packages will be installed:
cpp-4.9 gcc-4.9 gcc-4.9-base libasan1 libcloog-isl4 libgcc-4.9-dev
0 upgraded, 6 newly installed, 0 to remove and 128 not upgraded.
Need to get 13.2 MB/13.2 MB of archives.
After this operation, 46.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Err:1 http://il.archive.ubuntu.com/ubuntu zesty/universe amd64 gcc-4.9-base amd64 4.9.4-2ubuntu1
404  Not Found
Err:2 http://il.archive.ubuntu.com/ubuntu zesty/universe amd64 cpp-4.9 amd64 4.9.4-2ubuntu1
404  Not Found
Err:3 http://il.archive.ubuntu.com/ubuntu zesty/universe amd64 libasan1 amd64 4.9.4-2ubuntu1
404  Not Found
Err:4 http://il.archive.ubuntu.com/ubuntu zesty/universe amd64 libgcc-4.9-dev amd64 4.9.4-2ubuntu1
404  Not Found
Err:5 http://il.archive.ubuntu.com/ubuntu zesty/universe amd64 gcc-4.9 amd64 4.9.4-2ubuntu1
404  Not Found
Unable to correct missing packages.
E: Failed to fetch http://il.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.9/gcc-4.9-base_4.9.4-2ubuntu1_amd64.deb  404  Not Found
E: Failed to fetch http://il.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.9/cpp-4.9_4.9.4-2ubuntu1_amd64.deb  404  Not Found
E: Failed to fetch http://il.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.9/libasan1_4.9.4-2ubuntu1_amd64.deb  404  Not Found
E: Failed to fetch http://il.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.9/libgcc-4.9-dev_4.9.4-2ubuntu1_amd64.deb  404  Not Found
E: Failed to fetch http://il.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.9/gcc-4.9_4.9.4-2ubuntu1_amd64.deb  404  Not Found
E: Aborting install.

What is going on here? Thanks!

like image 555
OrenIshShalom Avatar asked Jan 23 '18 09:01

OrenIshShalom


People also ask

Is GCC already installed in Ubuntu?

The gcc package is installed by default on all Ubuntu desktop flavors.


1 Answers

It seems that gcc-4.9.4 is indeed missing from the main repository, which has only gcc-4.9.3: http://us.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.9

This explains the 404 Not Found error from apt.
As a first fix attempt, you may try the following, just in case there's a conflict which apt will be able to repair:

sudo apt-get update --fix-missing
sudo apt-get dist-upgrade
sudo apt-get install gcc-4.9 g++-4.9 gcc-4.9-multilib

Ubuntu 16.04

On Ubuntu 16.04, gcc-4.9 could be installed from the Launchpad Toolchain repository:

sudo apt-add-repository -yu 'deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main'
sudo apt update
sudo apt-get install gcc-4.9 g++-4.9 gcc-4.9-multilib

Ubuntu 18.04 (and probably 17.10, 17.04)

If the above didn't work, you could go about installing gcc-4.9 manually along with all required dependencies, by grabbing the required packages and installing them by order, using dpkg:

mkdir ~/Downloads/gcc-4.9-deb && cd ~/Downloads/gcc-4.9-deb

wget http://launchpadlibrarian.net/247707088/libmpfr4_3.1.4-1_amd64.deb
wget http://launchpadlibrarian.net/253728424/libasan1_4.9.3-13ubuntu2_amd64.deb
wget http://launchpadlibrarian.net/253728426/libgcc-4.9-dev_4.9.3-13ubuntu2_amd64.deb
wget http://launchpadlibrarian.net/253728314/gcc-4.9-base_4.9.3-13ubuntu2_amd64.deb
wget http://launchpadlibrarian.net/253728399/cpp-4.9_4.9.3-13ubuntu2_amd64.deb
wget http://launchpadlibrarian.net/253728404/gcc-4.9_4.9.3-13ubuntu2_amd64.deb
wget http://launchpadlibrarian.net/253728432/libstdc++-4.9-dev_4.9.3-13ubuntu2_amd64.deb
wget http://launchpadlibrarian.net/253728401/g++-4.9_4.9.3-13ubuntu2_amd64.deb

sudo dpkg -i gcc-4.9-base_4.9.3-13ubuntu2_amd64.deb
sudo dpkg -i libmpfr4_3.1.4-1_amd64.deb
sudo dpkg -i libasan1_4.9.3-13ubuntu2_amd64.deb
sudo dpkg -i libgcc-4.9-dev_4.9.3-13ubuntu2_amd64.deb
sudo dpkg -i cpp-4.9_4.9.3-13ubuntu2_amd64.deb
sudo dpkg -i gcc-4.9_4.9.3-13ubuntu2_amd64.deb
sudo dpkg -i libstdc++-4.9-dev_4.9.3-13ubuntu2_amd64.deb
sudo dpkg -i g++-4.9_4.9.3-13ubuntu2_amd64.deb

The above was tested on 18.04 and produced a functional installed gcc-4.9.

like image 173
valiano Avatar answered Sep 21 '22 01:09

valiano