安装redis-6.0.1到Linux报错server.c:xxxx:xx: error: ‘xxxxxxxx’ has no member named ‘xxxxx’

如果还不会安装redis到Linux系统上,这篇文章绝对让你整整明明白白的。
安装redis6.0.1。也是一样的安装方法。
但是这里会有点小问题。
在你进行到4、基本的环境安装。你会发现这里报了个小错,
如下server.c:xxxx:xx: error: ‘xxxxxxxx’ has no member named ‘xxxxx’。

[root@master redis-6.0.1]# make
……
server.c:5101:19: error: ‘struct redisServer’ has no member named ‘sofd’
         if (server.sofd > 0)
                   ^
server.c:5102:94: error: ‘struct redisServer’ has no member named ‘unixsocket’
             serverLog(LL_NOTICE,"The server is now ready to accept connections at %s", server.unixsocket);
                                                                                              ^
server.c:5103:19: error: ‘struct redisServer’ has no member named ‘supervised_mode’
         if (server.supervised_mode == SUPERVISED_SYSTEMD) {
                   ^
server.c:5104:24: error: ‘struct redisServer’ has no member named ‘masterhost’
             if (!server.masterhost) {
                        ^
server.c:5117:15: error: ‘struct redisServer’ has no member named ‘maxmemory’
     if (server.maxmemory > 0 && server.maxmemory < 1024*1024) {
               ^
server.c:5117:39: error: ‘struct redisServer’ has no member named ‘maxmemory’
……

首先我们来查看一下gcc的版本。

#查看gcc的版本是否在 5.3以上,centos7默认是4.8.5.我这里的就是4.8.5
gcc -v

解决方案:

#升级到 5.3及以上版本
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了。
以下其他版本同理,修改devtoolset版本号即可。

这时候你可以再看一下gcc的版本号。
接下来重新执行4、基本的环境安装及后续步骤即可。
快来试试redis6.0.1新版本吧!
转载于:https://blog.csdn.net/hello_cmy/article/details/106062327
欢迎访问我的个人博客:http://www.ayjup.cn

你可能感兴趣的:(安装redis-6.0.1到Linux报错server.c:xxxx:xx: error: ‘xxxxxxxx’ has no member named ‘xxxxx’)