-1

It may seems simlar to this question: Old version of gcc for new Ubuntu

but I can't solve it with the method provided in that thread

I get some error like

gcc-4.1 : Depends: cpp-4.1 (= 4.1.2-27ubuntu1) but it is not going to be installed

can someone tell me how to do it?

thanks

SSolid
  • 1
  • Remove cpp and try again :-) – Vitalie Ciubotaru Jun 04 '12 at 08:21
  • to Vitalie Ciubotaru , if I try to remove cpp ( version 4.6) , then I will need to remove a lot of softwares, this doesn't seem good – SSolid Jun 05 '12 at 04:01
  • That is true. If you want to downgrade gcc, a bunch of other packages will need to be downgraded, too. In general, there's no good mechanism to downgrade packages. The only way is to remove the new ones and to install them again indicating the desired versions (as advised in the answer below http://askubuntu.com/a/146264/64668). – Vitalie Ciubotaru Jun 06 '12 at 01:24
  • You can't with the version of Ubuntu that you have. – Braiam Mar 30 '14 at 15:59

2 Answers2

0

to downgrade a package the command we have is

sudo apt-get install <pkg_name=its version>

so for your case

sudo apt-get install gcc=4.1.1

after installing older version of gcc, use update-alternatives --config to switch to it

sudo update-alternatives --config gcc

then select the number corresponding to the version you want to switch to

Raja G
  • 102,391
  • 106
  • 255
  • 328
0

I always use Synaptic Package Manager to fix such issues. Using it you can forcefully install other version of packages.

  • Fist install synaptic package manager if you don't have already installed:

    $ sudo apt-get install synaptic
    
  • Then open synaptic package manager -> click Custom Filters down-left -> click Broken top-left, it will list all broken packages try to fix all broken packages. Also if any residual packages are there on more option you will get as residual packages. -Search for packages you want to downgrade/upgrade, highlight it by simply clicking on it do not mark(tick), chose Package from the menu -> Force Version and chose some other versions from the list. Then click Apply to install it.
  • Try to install again using command line.

Hope it works for you.

Saurav Kumar
  • 14,916