Hi, because my default gcc could not, not long ago I've installed a new gcc to compile assembly files

sudo apt install gcc-4.8

Now, in order to command gcc-4.8 SomeProgram.s with gcc SomeProgam.s I've directed my gcc to gcc-4.8 (or so I thought..)

I've used the following commands (after installing gcc-4.8):

$ sudo rm usr/bin/gcc
$ sudo ln -s usr/bin/gcc-4.8 /usr/bin/gcc

But now I get this message upon trying to get gcc to compile

Command 'gcc' not found, but can be installed with:

sudo apt install gcc

gcc-4.8 SomeProgram.s still works.

Upon installing gcc again I get info that implies that I already have gcc

But seems like I can't use it. So it must be a problem with the pointing.

Please help me get my gcc back. Please help me direct the gcc command to gcc-4.8.

Thanks in advanced.

  • 1. Do not remove files which are maintained by package manager! 2. Please add output of which gcc and all possible subsititutions with which gcc followed by <Tab>. Also consider to install whole build-essential package.
    – N0rbert
    Oct 23, 2018 at 20:28
  • Hey thank you for your comment. Output of which gcc is black (simply nothing happens). I already have build-essential and devtools. Also upon commanding to install gcc I get that it's already installed.
    – SDIdo
    Oct 24, 2018 at 8:19

1 Answer 1


Sorry I can't comment yet.

But I must point out that the original ln command is incorrect, which creates an incorrect relative link usr/bin/gcc-4.8 under /usr/bin/

Correct command is

sudo ln -s /usr/bin/gcc-4.8 /usr/bin/gcc


sudo ln -s gcc-4.8 /usr/bin/gcc
  • Thanks! I've directed it correctly now and gcc Hello.s work. (it uses gcc-4.8) How can I reinstall my previous gcc though?
    – SDIdo
    Oct 24, 2018 at 10:32
  • I think it is still accessible, for 18.04, it's gcc-7. Just run ls -l /usr/bin/gcc* to find your versions. Oct 24, 2018 at 10:49
  • Thank you Alvin it helps me to proceed :) I still have an issue there, but with you help I may be able to carry on!
    – SDIdo
    Oct 25, 2018 at 12:20
  • Creating symbolic link for gcc-4.8 works! I dont get why in other future versions of gcc it doesn't include 'cc1' but only 'cc1plus'.
    – Shaze
    Aug 2, 2019 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.