1. 程式人生 > 資料庫 >Linux Centos7安裝redis6.0.9、make報錯:make[1]: *** [server.o] Error 1(已解決)

Linux Centos7安裝redis6.0.9、make報錯:make[1]: *** [server.o] Error 1(已解決)

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 `/opt/redis-6.0.9/src'
make: *** [all] Error 2

問題分析及解決:

Redis官網下載版本為 6.0.9
make報錯是因為gcc版本過低,yum安裝的gcc是4.8.5的。
所以需要升級gcc,升級過程如下:

yum -y install centos-release-scl
 
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
 
scl enable devtoolset-9 bash
 
echo "source /opt/rh/devtoolset-9/enable" >> /etc/profile
 
gcc -v