Ubuntu: Update GCC to the 6.3 version [closed]



Question:

I want to use some c++ features only available in more recent versions of the language. The problem is, Ubuntu 15.04 has 4.9.2 installed and look at the output I get from apt-get install gcc:

Reading package lists... Done  Building dependency tree         Reading state information... Done  gcc is already the newest version.  0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.  2 not fully installed or removed.  After this operation, 0 B of additional disk space will be used.  Do you want to continue? [Y/n]  

It says it's already the newest version, I don't understand why...


Solution:1

The only option exist is to Build it from Sources, since you're running Vivid (15.04) version which has reached EOL (End Of Life).

  1. Download the source code and its prerequisites:

    wget https://ftp.gnu.org/gnu/gcc/gcc-6.3.0/gcc-6.3.0.tar.bz2  tar jxvf gcc-6.3.0.tar.bz2  cd gcc-6.3.0  ./contrib/download_prerequisites  
  2. Compile the sources (note: this command will differ depending on where you initially saved the .bz2 archive), you can also modify option for build command. In this case we'll use very basic option:

    cd ~  mkdir gcc-build && cd gcc-build  ../gcc-6.3.0/configure -v --prefix=$HOME/gcc-6.3.0  

    NOTE: Make sure you have read the docs to view available option.

  3. Now we are ready to build gcc

    • Run make command to build gcc, this steps will take a long time to complete.

      make  
    • Once the above phase is finished, you can install built gcc with:

      sudo make install  

      Once this process has completed, run the command gcc --version to verify that the installation has completed successfully.


Solution:2

Ubuntu 15.04 has reached end of life and has no support, which means no more updates or fixes (security, bugs or features) will be published.

You should update or reinstall with a newer Ubuntu version.

I'll recommend go with 16.10 (9 month support) which already has gcc 6.x branch on official repos.

But you also can go with 16.04 LTS (5 year support) and add a untrusted/unguaranted ppa to get latest gcc versions like this one

Personally, I would choose go with 16.10 and keep updating from official channels to later software/Ubuntu versions without adding (mostly) any ppa.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »