Eu tenho duas instalações do gcc no meu sistema Ubuntu 14.04 LTS. Normalmente, a seleção entre eles não seria um problema, mas o local de instalação de um é desconcertante.
$ which gcc
/usr/bin/gcc
$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
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.
$ sudo apt-get install gcc-4.9
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'sc-gcc-4.9.3' for regex 'gcc-4.9'
Note, selecting 'gcc-4.9-base' for regex 'gcc-4.9'
gcc-4.9-base is already the newest version.
sc-gcc-4.9.3 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
$ /usr/local/gcc/4.9.3/bin/gcc --version
gcc (GCC) 4.9.3
Copyright (C) 2015 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.
$ ls -l /usr/bin | grep gcc
-rwxr-xr-x 1 root root 428 May 7 2006 c89-gcc
-rwxr-xr-x 1 root root 454 Apr 11 2011 c99-gcc
lrwxrwxrwx 1 root root 7 Apr 7 2014 gcc -> gcc-4.8
-rwxr-xr-x 1 root root 775888 May 7 2016 gcc-4.8
lrwxrwxrwx 1 root root 10 Apr 7 2014 gcc-ar -> gcc-ar-4.8
-rwxr-xr-x 1 root root 26968 May 7 2016 gcc-ar-4.8
lrwxrwxrwx 1 root root 10 Apr 7 2014 gcc-nm -> gcc-nm-4.8
-rwxr-xr-x 1 root root 26968 May 7 2016 gcc-nm-4.8
lrwxrwxrwx 1 root root 14 Apr 7 2014 gcc-ranlib -> gcc-ranlib-4.8
-rwxr-xr-x 1 root root 26968 May 7 2016 gcc-ranlib-4.8
lrwxrwxrwx 1 root root 7 Apr 7 2014 x86_64-linux-gnu-gcc -> gcc-4.8
lrwxrwxrwx 1 root root 7 May 7 2016 x86_64-linux-gnu-gcc-4.8 -> gcc-4.8
lrwxrwxrwx 1 root root 10 Apr 7 2014 x86_64-linux-gnu-gcc-ar -> gcc-ar-4.8
lrwxrwxrwx 1 root root 10 May 7 2016 x86_64-linux-gnu-gcc-ar-4.8 -> gcc-ar-4.8
lrwxrwxrwx 1 root root 10 Apr 7 2014 x86_64-linux-gnu-gcc-nm -> gcc-nm-4.8
lrwxrwxrwx 1 root root 10 May 7 2016 x86_64-linux-gnu-gcc-nm-4.8 -> gcc-nm-4.8
lrwxrwxrwx 1 root root 14 Apr 7 2014 x86_64-linux-gnu-gcc-ranlib -> gcc-ranlib-4.8
lrwxrwxrwx 1 root root 14 May 7 2016 x86_64-linux-gnu-gcc-ranlib-4.8 -> gcc-ranlib-4.8
$ apt-cache policy sc-gcc-4.9.3
sc-gcc-4.9.3:
Installed: 1-20160726
Candidate: 1-20160726
Version table:
*** 1-20160726 0
500 http://usa-mirror.internal.net/mirrors/stable/3rdparty/trusty/ ./ Packages
100 /var/lib/dpkg/status
Então, o apt-get sabe que o gcc-4.9 está instalado, mas não tenho certeza porque ele acabou em /usr/local/gcc/4.9.3/bin em vez de / usr / bin.
Alguém pode fornecer alguma luz sobre isso? Qual é a melhor prática de como atualizar os links?