7

I need to install the latest version of GCC on Linux Mint 13. I found some useful terminal commands for Ubuntu 12.04, but it seems that nothing similar for Mint exists on the Internet...

Edit: I solved the problem, so, in order to help everybody else, write these commands:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test

sudo apt-get update

sudo apt-get install g++-4.7 c++-4.7

And everything works fine. :)

2 Answers 2

6

I built it from source when I did this not too long ago.

I followed the instructions here, but I downloaded and extracted gcc 4.7.2 first instead of last and replaced steps 3 to 5 with running this script that comes with it (which does those steps for you):

gcc-4.7.2/contribs/download_prerequisites

You can download the gcc sources from one of the mirror sites: http://gcc.gnu.org/mirrors.html


Edit: added the instructions in-post

  1. Download and extract g++-4.7.2

  2. $sudo apt-get install gcc-multilib m4

  3. In order to compensate for insufficient path information, added this to .bashrc

    export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

    export LIBRARY_PATH=/usr/lib/i386-linux-gnu export

    export C_INCLUDE_PATH=/usr/include/i386-linux-gnu export

    export CPLUS_INCLUDE_PATH=/usr/include/i386-linux-gnu

  4. Add these symlinks for the same reason:

    $sudo ln -s /usr/include/i386-linux-gnu/gnu/stubs-32.h /usr/include/gnu

    $sudo ln -s /usr/lib/i386-linux-gnu/crti.o /usr/lib/crti.o

    $sudo ln -s /usr/lib/i386-linux-gnu/crt1.o /usr/lib/crt1.o

    $sudo ln -s /usr/lib/i386-linux-gnu/crtn.o /usr/lib/crtn.o

    $sudo ln -s /usr/local/lib/libmpc.so.3 /usr/lib/libmpc.so.3

  5. run gcc-4.7.2/contribs/download_prerequisites

  6. configure, make, make install

3

To find a specific package type

apt-cache search "package"

In your case "gcc". Mine showed at least 40 different gnu compiler packages to choose from. The one it sounds like you want is gcc-4.7-base. Also you could update apt-get before searching.

sudo apt-get update

Not the answer you're looking for? Browse other questions tagged or ask your own question.