Search This Blog

Thursday 13 October 2016

GCC and G++ -4.8 installation in Ubuntu 12.04

Version of gcc, for 12.04, is 4.8.1 and is available in the toolchain PPA.

Adding the toolchain/test PPA:

To add the PPA to your system, open a terminal(Ctrl+Alt+t) and run the following commands:

sudo apt-get install python-software-properties  sudo add-apt-repository ppa:ubuntu-toolchain-r/test  sudo apt-get update  sudo apt-get install gcc-4.8 g++-4.8  sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50  
If you need gcc-4.8 on 12.04 now, your only option is to build it from source.

Please read the GCC installation FAQ prior to installation.

You can download gcc-4.8 from one of gnu.org's mirror sites or directly from their SVN server.

Here is an example of steps to compile from source (see here for additional details.) Note that these may vary depending on your system and preferences.

  1. Download the source code

  2. Install some additional libraries (sudo apt-get install libgmp-dev libmpfr-dev libmpc-dev libc6-dev)

  3. Compile the source: ./gcc-4.8.0/configure --prefix=/app/gcc/4.8.0
  4. Run make (This will take some time to complete. Go make some coffee, or bake some cookies. ;-))
  5. Install the code: sudo make install

Once this process has completed, run the command gcc --version to verify that the installation has completed successfully. You should see something similar to the following output:

getmefollks@kickyou:~$ gcc --version  gcc (Linaro 4.8.0) 4.8.0  Copyright (C) 2013 Free Software Foundation, Inc.  This is free software; see the source for copying conditions.  There is NO  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  

No comments:

Post a Comment