I have rm-r
all the files starting with gcc
and g++
from my /usr/bin
..
Now when I am trying to reinstall it using sudo apt-get install gcc
I am getting following error
Reading package lists... Done
Building dependency tree
Reading state information... Done
gcc is already the newest version (4:5.3.1-1ubuntu1).
The following packages were automatically installed and are no longer required:
libgcrypt20:i386 libsystemd0:i386 linux-headers-4.4.0-38 linux-headers-4.4.0-38-generic
linux-image-4.4.0-38-generic linux-image-extra-4.4.0-38-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up gcc (4:5.3.1-1ubuntu1) ...
update-alternatives: error: alternative path /usr/bin/gcc doesn't exist
dpkg: error processing package gcc (--configure):
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
gcc
E: Sub-process /usr/bin/dpkg returned an error code (1)
I tried the following commands:
sudo dpkg --purge --force-depends gcc
sudo apt-get autoremove -y
sudo apt-get autoclean -y
sudo apt-get clean gcc
These were the results:
Some packages could not be installed.
This may mean that you have requested an impossible situation
or if you are using the unstable distribution that some required packages
have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
build-essential : Depends: g++ (>= 4:5.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.