Centos6.5 升級gcc

GCC官網(wǎng)
GMP 官網(wǎng)
MPFR
MPC

  1. 前往GCC官網(wǎng) 下載最新gcc,下載完成后解壓安裝包:
tar -zxcf gcc-9.2.0.tar.gz

  1. 獲取依賴 GMP,MPFR,MPC
cd gcc-9.2.0
#執(zhí)行
./contrib/download_prerequisites

  1. 安裝gcc
./configure -enable-checking=release -enable-languages=c,c++ -disable-multilib

make && make install

查看版本信息,如果沒有更改則修改環(huán)境變量

[root@localhost bin]# gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)
Copyright (C) 2010 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.

  1. 添加環(huán)境變量,否則gcc還是識別舊版本。
vi /etc/profile
#添加:
...
PATH=/usr/local/bin:$PATH
...
#重啟profile
source /etc/profile
  1. 再次檢測版本是否變化.
#安裝成功
[root@localhost bin]# ./gcc --version
gcc (GCC) 9.2.0
Copyright (C) 2019 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.
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容