CentOS 7安裝GCC 8.2 實錄

#!/bin/bash

yum -y install wget bzip2 gcc gcc-c++ glibc-headers

wget -c -P /opt/tmp/ https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-8.2.0/gcc-8.2.0.tar.gz

cd /opt/tmp/

tar zxvf gcc-8.2.0.tar.gz

cd gcc-8.2.0

./contrib/download_prerequisites                     #下載gmp mpfr mpc

cd ../    

mkdir build-gcc-8.2                     #不能在source目錄下configure必須在上一層的目錄下

cd build-gcc-8.2

../gcc-8.2.0/configure --prefix=/usr/local/gcc --enable-bootstrap --enable-checking=release --enable-languages=c,c++ --disable-multilib

make -j N

make install

#配置環境變量

gcc -v                                                                           #查看當前gcc版本

echo -e '\nexport PATH=/usr/local/gcc/bin:$PATH\n' >> /etc/profile.d/gcc.sh && source /etc/profile.d/gcc.sh

#導出頭文件

ln -sv /usr/local/gcc/include/ /usr/include/gcc

#導出庫文件

vim /etc/ld.so.conf.d/gcc.conf

/usr/local/gcc/lib64                                                      #64位系統

ldconfig -v                     #配置生效

ldconfig -p |grep gcc                     #導出驗證


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章