2

I am trying to install version 6.3.0 of gcc. I need that one in particular and I do not know how to do it. Since if I run "sudo apt-get install gcc" it updates me to the latest version (7.4) and it does not work for me.

Thank you!

Juass93
  • 121

2 Answers2

0

For getting gcc version 6.3.0, first you've to download the source:

wget https://github.com/gcc-mirror/gcc/archive/gcc-6_3_0-release.tar.gz

Then extract it:

tar xvzf gcc-6_3_0-release.tar.gz

Then install it according to their official documentation.

abu_bua
  • 10,783
  • Could you tell me what commands to enter to install it? I am new with this operating system and I do not understand the official documentation well... Thank you very much anyway – Juass93 Nov 26 '18 at 18:56
  • 1
    Tarballs are recommended only for those who already have some skills. If, as a beginner, you insist upon specific versions and complex install methods, then you may find your learning curve to be frustrating. .tar.gz files usually include a README file and an INSTALL file. Read them. – user535733 Nov 26 '18 at 19:10
  • I don't know how to do... I'm very desperate I can not install the compiler. Help me please – Juass93 Nov 28 '18 at 16:12
  • Yeah, useless answer. – Russell Trahan Dec 04 '19 at 16:31
0

First check what versions of gcc are offered from the standard repositories:

apt-cache pkgnames |egrep gcc-[0-9]*$

If you see the one you want, just install it:

sudo apt-get install gcc-6

To run this version of gcc (different than the system default) for your project, you may:

  1. Set up an alias (alias gcc=/bin/gcc-6) either in a script specific to your project or in your .bashrc file.
  2. Put in a gcc link in your bin directory to override the system gcc found later in your PATH.
  3. Put the project's bin directory early in your PATH, and put a link to gcc there. This location may also be the appropriate one for a gcc verion not supplied from the standard repositories. Add the executables for the old gcc to the project specific bin.

Do NOT alter the update-alternatives for the gcc compiler to change the system default to the different gcc version. The system was build with a specific compiler version, and expects that version to be available when needed for kernel modules updates. Search this site for "update broke my computer" to see the consequences of a video module which fails to compile.

ubfan1
  • 17,838