Update GCC to the 6.3 version [closed]

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.