centos7中根据gcc编译器安装包升级gcc编译器01
001、系统信息
[root@PC1 home]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release 7.6.1810 (Core) Release: 7.6.1810 Codename: Core
002、当前gcc版本
[root@PC1 home]# gcc --version gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36) Copyright (C) 2015 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.
003、安装升级依赖
[root@PC1 home]# yum install -y gcc-c++ glibc-devel mpfr-devel libmpc-devel gmp-devel glibc-devel.i686
004、下载安装包
[root@PC1 software]# wget -c https://ftp.gnu.org/gnu/gcc/gcc-13.1.0/gcc-13.1.0.tar.gz --no-check-certificate
005、解压安装包
[root@PC1 software]# tar -xzvf gcc-13.1.0.tar.gz [root@PC1 software]# cd gcc-13.1.0/
006、下载依赖包
[root@PC1 gcc-13.1.0]# ./contrib/download_prerequisites
007、创建build目录
[root@PC1 gcc-13.1.0]# mkdir build [root@PC1 gcc-13.1.0]# cd build/
008、安装到指定目录(说明:若安装到非/usr目录,如安装到/opt/gcc,则在编译完成后需要配置环境变量、建立软连接。)
[root@PC1 build]# ../configure --enable-checking=release --enable-language=c,c++ --disable-multilib --prefix=/usr
009、编译安装
[root@PC1 build]# make -j4
010、
[root@PC1 build]# make install
011、测试gcc版本
[root@PC1 build]# gcc --version gcc (GCC) 13.1.0 Copyright (C) 2023 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.
升级成功。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步