当前位置:首页 > IT技术 > 数据库 > 正文

centos7 gcc-11 gcc-c++-11 gdb-11 lex(flex) yacc(bsion)环境搭建
2022-09-06 22:57:54

参考:https://blog.csdn.net/qq_45316173/article/details/122018354

 

卸载旧版本

rpm -q gcc 

rpm -e [上一步查到的版本号]

 

执行上面一条命令可能会报错,卸载失败:

error: Failed dependencies:

gcc = 4.4.7-23.el6 is needed by (installed) gcc-c++-4.4.7-23.el6.x86_64
gcc = 4.4.4 is needed by (installed) libtool-2.2.6-15.5.el6.x86_64

说明要卸载的程序已经被其他程序依赖

将依赖gcc的程序卸载:

rpm -e gcc-c++-4.4.7-23.el6.x86_64
rpm -e libtool-2.2.6-15.5.el6.x86_64

然后,再次执行卸载gcc的命令:

rpm -e [上一步查到的版本号]

 

yum -y install centos-release-scl

yum install -y devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-gdb

scl enable devtoolset-11 bash

which gcc
which cc
which g++
which gdb

 

cat >> /etc/profile << EOF
export PATH=$PATH:/opt/rh/devtoolset-11/root/usr/bin
EOF

 

source /etc/profile

 

yum -y install flex
yum -y install flex-devel
yum -y install bison

 

本文摘自 :https://www.cnblogs.com/

开通会员,享受整站包年服务立即开通 >