安装redis中执行make时出错及解决方案 make[1]: *** [server.o] Error 1 ...... make:*** [all] Error2

安装redis出现些之前安装不曾出现错误
稳定版6.0.1之后版本都会出现这个问题!!!
在这里插入图片描述
解决办法为:升级 gcc到最新版本

[root@localhost redis-6.0.1]# gcc -v                             
[root@localhost redis-6.0.1]# yum -y install centos-release-scl  
[root@localhost redis-6.0.1]# yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
[root@localhost redis-6.0.1]# scl enable devtoolset-9 bash
[root@localhost redis-6.0.1]# echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile

先安装 gcc 后安装 redis 时编译make 时发生错误

server.c:5297:29: error: ‘struct redisServer’ has no member named ‘pidfile’
     if (background || server.pidfile) createPidFile();
                             ^
server.c:5302:16: error: ‘struct redisServer’ has no member named ‘sentinel_mode’
     if (!server.sentinel_mode) {
     
                ^
server.c:5312:19: error: ‘struct redisServer’ has no member named ‘cluster_enabled’
         if (server.cluster_enabled) {
     
                   ^
server.c:5320:19: error: ‘struct redisServer’ has no member named ‘ipfd_count’
         if (server.ipfd_count > 0 || server.tlsfd_count > 0)
                   ^
server.c:5320:44: error: ‘struct redisServer’ has no member named ‘tlsfd_count’
         if (server.ipfd_count > 0 || server.tlsfd_count > 0)
                                            ^
server.c:5322:19: error: ‘struct redisServer’ has no member named ‘sofd’
         if (server.sofd > 0)
                   ^
server.c:5323: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:5324:19: error: ‘struct redisServer’ has no member named ‘supervised_mode’
         if (server.supervised_mode == SUPERVISED_SYSTEMD) {
     
                   ^
server.c:5325:24: error: ‘struct redisServer’ has no member named ‘masterhost’
             if (!server.masterhost) {
     
                        ^
server.c:5335:19: error: ‘struct redisServer’ has no member named ‘supervised_mode’
         if (server.supervised_mode == SUPERVISED_SYSTEMD) {
     
                   ^
server.c:5342:15: error: ‘struct redisServer’ has no member named ‘maxmemory’
     if (server.maxmemory > 0 && server.maxmemory < 1024*1024) {
     
               ^
server.c:5342:39: error: ‘struct redisServer’ has no member named ‘maxmemory’
     if (server.maxmemory > 0 && server.maxmemory < 1024*1024) {
     
                                       ^
server.c:5343: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:5346:31: error: ‘struct redisServer’ has no member named ‘server_cpulist’
     redisSetCpuAffinity(server.server_cpulist);
                               ^
server.c: In function ‘hasActiveChildProcess’:
server.c:1478:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
server.c: In function ‘allPersistenceDisabled’:
server.c:1484:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
server.c: In function ‘writeCommandsDeniedByDiskError’:
server.c:3934:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
server.c: In function ‘iAmMaster’:
server.c:5134:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make[1]: *** [server.o] Error 1
make[1]: Leaving directory `/usr/mybin/redis-6.0.9/src'
make: *** [all] Error 2

稳定版6.0.1之前的版本正常安装步骤如下:

[root@localhost ~]# yum install gcc
[root@localhost ~]# cd /usr/local
[root@localhost local]# wget http://download.redis.io/releases/redis-6.0.1.tar.gz
[root@localhost local]# tar -xvf redis-6.0.1.tar.gz
[root@localhost local]# cd /usr/local/redis-6.0.1/
[root@localhost redis-6.0.1]# make PREFIX=/usr/local/redis install

解决办法为:升级 gcc到最新版本

[root@localhost redis-6.0.1]# gcc -v                             # 查看gcc版本
[root@localhost redis-6.0.1]# yum -y install centos-release-scl  # 升级到9.1版本
[root@localhost redis-6.0.1]# yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
[root@localhost redis-6.0.1]# scl enable devtoolset-9 bash
以上为临时启用,如果要长期使用gcc 9.1的话:
[root@localhost redis-6.0.1]# echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile

再执行编译

PREFIX 安装目录

[root@localhost redis-6.0.1]# make install PREFIX=/usr/local/redis

**安装成功会出现:Hint: It’s a good idea to run ‘make test’ **
安装redis中执行make时出错及解决方案 make[1]: *** [server.o] Error 1 ...... make:*** [all] Error2_第1张图片
表示安装成功了,可以到安装下src目录下查看:redis-server、redis-cli、redis-check-rdb、redis-check-aof 都生成了

redis-6.0.9/src/redis-server
redis-6.0.9/src/redis-cli
redis-6.0.9/src/redis-check-rdb
redis-6.0.9/src/redis-check-aof

参考: https://www.cnblogs.com/shook/p/12883742.html

你可能感兴趣的:(Nginx,linux,redis,服务器,nosql)