server.c:5166:39: error: ‘struct redisServer’ has no member named ‘maxmemory’

环境

阿里云 CentOS7
Linux version 3.10.0-1062.18.1.el7.x86_64
redis:redis-6.0.6 稳定版

1、错误示例

make 时报错:

server.c:5151: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:5152:19: error: ‘struct redisServer’ has no member named ‘supervised_mode’
if (server.supervised_mode == SUPERVISED_SYSTEMD) {
^
server.c:5153:24: error: ‘struct redisServer’ has no member named ‘masterhost’
if (!server.masterhost) {
^
server.c:5166:15: error: ‘struct redisServer’ has no member named ‘maxmemory’
if (server.maxmemory > 0 && server.maxmemory < 10241024) {
^
server.c:5166:39: error: ‘struct redisServer’ has no member named ‘maxmemory’
if (server.maxmemory > 0 && server.maxmemory < 1024
1024) {
^
server.c:5167:176: error: ‘struct redisServer’ has no member named ‘maxmemory’
serverLog(LL_WARNING,“WARNING: You specified a maxmemory value that is less than 1MB (current value is %llu bytes). Are you sure this is what you really want?”, server.maxmemory);
^
server.c:5170:31: error: ‘struct redisServer’ has no member named ‘server_cpulist’
redisSetCpuAffinity(server.server_cpulist);

2、错误原因

gcc版本问题,新版本的。redis6.0以上

gcc -v# 查看gcc版本

这是我可以使用的版本的版本信息:
[root@iZuf6dmgl1ay07mnslvfn5Z redis-6.0.6]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/lto-wrapper
Target: x86_64-redhat-linux
Configured with: …/configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-9/root/usr --mandir=/opt/rh/devtoolset-9/root/usr/share/man --infodir=/opt/rh/devtoolset-9/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --with-default-libstdcxx-abi=gcc4-compatible --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-9.3.1-20200408/obj-x86_64-redhat-linux/isl-install --disable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)

3、解决办法

升级到 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

4、重新安装

 #删除解压make过的文件夹,重新解压
rm -rm redis-6.0.6
tar -zxvf redis-6.0.6.tar.gz
#重新make
cd redis-6.0.6
make 

然后继续执行安装操作, 就不在这里赘述了。

转自 : https://blog.csdn.net/xixiyuguang/article/details/106612841

你可能感兴趣的:(运维,NoSql)