centos安装gcc 4.9.4 版本

系统:centos 7.6

因为在安装hyperf热加载时需要用到fswatch,安装fswatch需要gcc4.9以上的版本,但是系统自带的gcc只有4.8的版本,所以我们需要安装4.9的,这里我安装的是4.9.4的版本:

yum install -y gcc gcc-c++
#因为我有自带的gcc 所以不用安装,如果没有的话。需要先安装yum自带的gcc

安装好后安装gmp:

#使用阿里云的gun镜像下载
yum install -y m4
wget https://mirrors.aliyun.com/gnu/gmp/gmp-6.1.1.tar.bz2 tar -xvjf gmp-6.1.1.tar.bz2 cd gmp-6.1.1 ./configure --prefix=/usr/local/ && make && make install

安装mpfr

wget https://mirrors.aliyun.com/gnu/mpfr/mpfr-3.1.5.tar.gz
tar -zxvf mpfr-3.1.5.tar.gz
cd mpfr-3.1.5
./configure --prefix=/usr/local/ --with-gmp=/usr/local/ && make && make install

安装mpc

wget https://mirrors.aliyun.com/gnu/mpc/mpc-1.0.3.tar.gz
tar -zxvf mpc-1.0.3.tar.gz
cd mpc-1.0.3
./configure --prefix=/usr/local/ --with-gmp=/usr/local/ --with-mpfr=/usr/local/
make && make install

安装gcc

wget https://mirrors.aliyun.com/gnu/gcc/gcc-4.9.4/gcc-4.9.4.tar.gz
tar -zxvf gcc-4.9.4.tar.gz
cd gcc-4.9.4
./configure --prefix=/usr/local/gcc-4.9.4 --enable-threads=posix --disable-checking --disable-multilib --enable-languages=c,c++ --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local
make && make install

编译gcc总共大概要编译一个小时,编译好之后卸载原有的gcc:

复制代码
yum remove gcc gcc-c++
ln -s /usr/local/gcc-4.9.4/bin/c++ /usr/bin/c++
ln -s /usr/local/gcc-4.9.4/bin/g++ /usr/bin/g++
ln -s /usr/local/gcc-4.9.4/bin/gcc /usr/bin/gcc

vim /etc/profile
LD_LIBRARY_PATH=/usr/local/gcc-4.9.4/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

source /etc/profile
复制代码

 

至此gcc4.9.4安装完成!

posted @   来碗酒喝  阅读(616)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示