【EmbeddedDev】升级gcc到4.8版本(旧版本为4.6)

来源:互联网 发布:c语言课件 编辑:程序博客网 时间:2024/05/16 08:56

升级gcc到4.8版本(旧版本为4.6)

  • 背景
    beagleboneblack板上debian7系统gcc的版本过旧(gcc4.6), 需要升级为4.8版本。需要更新下载源列表才能获取4.8可用版本。

  • 参考链接
    http://stackoverflow.com/questions/16311600/installing-gcc-4-8-on-debian

  • 修改源列表/etc/apt/sources.list, 增加
deb http://ftp.cn.debian.org/debian/ jessie main non-free contribdeb http://ftp.uk.debian.org/debian/ jessie main non-free contrib
  • 更新源设置
apt-get update
  • 查看gcc可用版本
root@beaglebone:/data/packages# apt-cache search gcccolorgcc - Colorizer for GCC warning/error messagescross-gcc-dev - Tools for building cross-compilers and cross-compiler packagesgcc-4.8 - GNU C compilergcc-4.8-base - GCC, the GNU Compiler Collection (base package)gcc-4.8-locales - GCC, the GNU compiler collection (native language support files)gcc-4.8-plugin-dev - Files for GNU GCC plugin development.gcc-4.8-source - Source of the GNU Compiler Collectiongccgo-4.8 - GNU Go compilergdc-4.8 - GNU D compiler (version 2), based on the GCC backendlibgcc-4.8-dev - GCC support library (development files)gcc-4.9 - GNU C compilergcc-4.9-base - GCC, the GNU Compiler Collection (base package)gcc-4.9-locales - GCC, the GNU compiler collection (native language support files)gcc-4.9-plugin-dev - Files for GNU GCC plugin development.gcc-4.9-source - Source of the GNU Compiler Collectiongccgo-4.9 - GNU Go compilergdc-4.9 - GNU D compiler (version 2), based on the GCC backendlibgcc-4.9-dev - GCC support library (development files)
  • 安装gcc4.8
root@beaglebone:/data/packages# aptitude install gcc-4.8The following NEW packages will be installed:  cpp-4.8{ab} gcc-4.8{b} gcc-4.8-base{ab} libcloog-isl4{ab} libisl10{a} libmpc3{ab} The following packages will be REMOVED:  cpp-4.7{u} 0 packages upgraded, 6 newly installed, 1 to remove and 112 not upgraded.Need to get 8436 kB of archives. After unpacking 12.7 MB will be used.The following packages have unmet dependencies: gcc-4.8 : Depends: binutils (>= 2.24.90.20141219) but 2.22-8+deb7u2 is installed and it is kept back.           Depends: libgcc-4.8-dev (>= 4.8.4-1) but it is not going to be installed.           Depends: libmpfr4 (>= 3.1.2) but 3.1.0-5 is installed. gcc-4.8-base : Breaks: gcc-4.7-base (< 4.7.3) but 4.7.2-5 is installed. cpp-4.8 : Depends: libmpfr4 (>= 3.1.2) but 3.1.0-5 is installed. libcloog-isl4 : Depends: libisl10 (>= 0.11) but 0.10-3 is to be installed. libmpc3 : Depends: libmpfr4 (>= 3.1.2) but 3.1.0-5 is installed.open: 39; closed: 102; defer: 20; conflict: 20                                                        .The following actions will resolve these dependencies:     Keep the following packages at their current version:1)     cpp-4.8 [Not Installed]                            2)     gcc-4.8 [Not Installed]                            3)     gcc-4.8-base [Not Installed]                       4)     libcloog-isl4 [Not Installed]                      5)     libmpc3 [Not Installed]                            Accept this solution? [Y/n/q/?] nopen: 70; closed: 249; defer: 39; conflict: 41                                                                                                                                                             .The following actions will resolve these dependencies:      Remove the following packages:                                  1)      gcc-4.7-base                                                        Install the following packages:                                 2)      gcc-4.9-base [4.9.2-10 (stable)]                              3)      libasan0 [4.8.4-1 (stable)]                                   4)      libatomic1 [4.9.2-10 (stable)]                                5)      libgcc-4.8-dev [4.8.4-1 (stable)]                             6)      libisl10 [0.12.2-2 (stable)]                                        Upgrade the following packages:                                 7)      binutils [2.22-8+deb7u2 (now, oldstable) -> 2.25-5 (stable)]  8)      libc-bin [2.13-38+deb7u8 (now) -> 2.19-18+deb8u4 (stable)]    9)      libc-dev-bin [2.13-38+deb7u8 (now) -> 2.19-18+deb8u4 (stable)]10)     libc6 [2.13-38+deb7u8 (now) -> 2.19-18+deb8u4 (stable)]       11)     libc6-dev [2.13-38+deb7u8 (now) -> 2.19-18+deb8u4 (stable)]   12)     libgcc1 [1:4.7.2-5 (now, oldstable) -> 1:4.9.2-10 (stable)]   13)     libgfortran3 [4.7.2-5 (now, oldstable) -> 4.9.2-10 (stable)]  14)     libgomp1 [4.7.2-5 (now, oldstable) -> 4.9.2-10 (stable)]      15)     libmpfr4 [3.1.0-5 (now, oldstable) -> 3.1.2-2 (stable)]       16)     libstdc++6 [4.7.2-5 (now, oldstable) -> 4.9.2-10 (stable)]    17)     locales [2.13-38+deb7u8 (now) -> 2.19-18+deb8u4 (stable)]     Accept this solution? [Y/n/q/?] YThe following NEW packages will be installed:  cpp-4.8{a} gcc-4.8 gcc-4.8-base{a} gcc-4.9-base{a} libasan0{a} libatomic1{a} libcloog-isl4{a} libgcc-4.8-dev{a} libisl10{a} libmpc3{a} The following packages will be REMOVED:  cpp-4.7{u} gcc-4.7-base{a} The following packages will be upgraded:  binutils libc-bin libc-dev-bin libc6 libc6-dev libgcc1 libgfortran3 libgomp1 libmpfr4 libstdc++6 locales 11 packages upgraded, 10 newly installed, 2 to remove and 106 not upgraded.Need to get 24.4 MB of archives. After unpacking 23.1 MB will be used.Do you want to continue? [Y/n/?] Y
  • 安装g++-4.8
root@beaglebone:/usr/bin# aptitude install g++-4.8The following NEW packages will be installed:  g++-4.8 libstdc++-4.8-dev{a} 0 packages upgraded, 2 newly installed, 0 to remove and 106 not upgraded.Need to get 11.5 MB of archives. After unpacking 27.4 MB will be used.Do you want to continue? [Y/n/?] YGet: 1 http://ftp.cn.debian.org/debian/ jessie/main libstdc++-4.8-dev armhf 4.8.4-1 [1096 kB]Get: 2 http://ftp.cn.debian.org/debian/ jessie/main g++-4.8 armhf 4.8.4-1 [10.4 MB]Fetched 11.5 MB in 3s (3300 kB/s)  perl: warning: Setting locale failed.perl: warning: Please check that your locale settings:    LANGUAGE = (unset),    LC_ALL = (unset),    LC_TIME = "zh_CN.UTF-8",    LC_MONETARY = "zh_CN.UTF-8",    LC_ADDRESS = "zh_CN.UTF-8",    LC_TELEPHONE = "zh_CN.UTF-8",    LC_NAME = "zh_CN.UTF-8",    LC_MEASUREMENT = "zh_CN.UTF-8",    LC_IDENTIFICATION = "zh_CN.UTF-8",    LC_NUMERIC = "zh_CN.UTF-8",    LC_PAPER = "zh_CN.UTF-8",    LANG = "en_US.UTF-8"    are supported and installed on your system.perl: warning: Falling back to the standard locale ("C").locale: Cannot set LC_ALL to default locale: No such file or directorySelecting previously unselected package libstdc++-4.8-dev:armhf.(Reading database ... 60868 files and directories currently installed.)Unpacking libstdc++-4.8-dev:armhf (from .../libstdc++-4.8-dev_4.8.4-1_armhf.deb) ...Selecting previously unselected package g++-4.8.Unpacking g++-4.8 (from .../g++-4.8_4.8.4-1_armhf.deb) ...Setting up libstdc++-4.8-dev:armhf (4.8.4-1) ...Setting up g++-4.8 (4.8.4-1) ...root@beaglebone:/usr/bin# ls /usr/bin/g++g++      g++-4.6  g++-4.8  
  • 设置默认为4.8版本
rm -f /usr/bin/gccln -s /usr/bin/gcc-4.8 /usr/bin/gccrm -f /usr/bin/g++ln -s /usr/bin/g++-4.8 /usr/bin/g++
1 0
原创粉丝点击