【缘起】
编译安装 redis 6 , make 时,报错:
... error: ‘struct redisServer’ has no member named ...
【答案】
GCC版本过低,需要升级到 5.3及以上版本。
编译安装GCC:https://amon.org/gcc
【安装】
参考:https://blog.csdn.net/hello_cmy/article/details/106062327
yum -y install centos-release-scl yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils scl enable devtoolset-9 bash
注意:scl 命令启用只是临时的,退出推出xshell或者重启就会恢复到原来 GCC 版本。
如果要长期生效的话,执行:
echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile
注:执行完此命令后,重新打开xshell窗口就是新版 GCC 。
如果需要安装其他 GCC 版本同理,修改 devtoolset 版本号即可。