导航

Debian 升级 gcc ≥ 4.8

debian 7 默认 gcc 版本是 v4.6,一些情况需要升级到 4.8,过程:
1.添加软件源

nano /etc/apt/sources.list
http://ftp.us.debian.org/debian/
apt-get update

2.检查可安装 gcc 版本列表

apt-cache search gcc
列出:

gnat-4.9 - GNU Ada compiler
gnat-4.9-base - GNU Ada compiler (common files)
gnat-4.9-sjlj - GNU Ada compiler (setjump/longjump runtime library)
libgnat-4.9 - runtime for applications compiled with GNAT (shared library)
libgnat-4.9-dbg - runtime for applications compiled with GNAT (debugging symbols)
libgnatprj4.9 - GNU Ada compiler Project Manager (shared library)
libgnatprj4.9-dbg - GNU Ada compiler Project Manager (debugging symbols)
libgnatprj4.9-dev - GNU Ada compiler Project Manager (development files)
libgnatvsn4.9 - GNU Ada compiler selected components (shared library)
libgnatvsn4.9-dbg - GNU Ada compiler selected components (debugging symbols)
libgnatvsn4.9-dev - GNU Ada compiler selected components (development files)

3.允许安装 gcc 4.9
aptitude install gcc-4.9

The following NEW packages will be installed:
  cpp-4.9{a} gcc-4.9 gcc-4.9-base{ab} libasan1{a} libatomic1{a}
  libcilkrts5{a} libcloog-isl4{a} libgcc-4.9-dev{a} libisl10{a} liblsan0{a}
  libmpc3{a} libtsan0{a} libubsan0{a}
...
      Remove the following packages:
1)      cpp-4.7
2)      g++-4.7
3)      gcc-4.7
4)      gcc-4.7-base
...
Accept this solution? [Y/n/q/?]y
...
Need to get 56.1 MB of archives. After unpacking 42.5 MB will be used.
Do you want to continue? [Y/n/?]y

4.设置默认为 4.9 版本

rm -f /usr/bin/gcc
ln -s /usr/bin/gcc-4.9 /usr/bin/gcc
rm -f /usr/bin/g++
ln -s /usr/bin/g++-4.9 /usr/bin/g++

5.检查

gcc -v
gcc version 4.9.2 (Debian 4.9.2-10)

2016-10-19
选择表情