Update GCC to the 6.3 version
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).
-
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
-
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.
-
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.
Related videos on Youtube
Fabrício Santana
Updated on September 18, 2022Comments
-
Fabrício Santana over 1 year
I want to use some C++ features only available in more recent versions of the language. The problem is Ubuntu 15.04 (Vivid Vervet) has 4.9.2 installed and looking 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...
-
Raziman T V over 7 yearsUbuntu 15.04 is no longer supported, perhaps you should move to a newer version. Old versions of Ubuntu usually do not have the latest versions of packages, you have to upgrade the distribution or install your package from a ppa or build it from source.
-
-
Fabrício Santana about 7 yearsWhat does the "-v" option do? I can't seem to find it on gcc.gnu.org/install/configure.html
-
Liso about 7 years
-
HelloGoodbye almost 7 yearsTo which folder is g++6.3 installed when following these steps? To
~/gcc-6.3.0
, to~/gcc-build
or to some other folder? Shouldn't any of the folders that was created be removed after running these commands or are they all still required? -
HelloGoodbye almost 7 years
tar xzvf gcc-6.3.0.tar.bz2
just printsgzip: stdin: not in gzip format
;tar: Child returned status 1
;tar: Error is not recoverable: exiting now
, so I unpacked the archive with the archive manager. -
HelloGoodbye almost 7 yearsWhen I run
../gcc-6.3.0/configure -v --prefix=$HOME/gcc-6.3.0
, I get/usr/bin/ld: cannot find crt1.o: No such file or directory
,/usr/bin/ld: cannot find crti.o: No such file or directory
,/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a when searching for -lgcc
,/usr/bin/ld: cannot find -lgcc
and similar errors. -
Astrid almost 6 yearsWell that did not work.
-
Andrew D. King over 5 yearsThis worked for me but I now have 2.4GB in my ~/gcc-6.3.0 directory... maybe a silly question but do I really need all of this, and is there a better place to put it?