環境:centos7 + redis 5.0
解決方案僅供參考,如不能解決問題,請查找請他方案。
1、不能編譯沒有GCC 編譯工具
make報錯:
make[1]: [persist-settings] Error 2 (ignored)
CC adlist.o
/bin/sh: cc: command not found
make[1]: *** [adlist.o] Error 127
make[1]: Leaving directory `/usr/local/redis-5.0.0/src'
make: *** [all] Error 2
解決方法:安裝gcc
命令如下:yum install gcc
2、os版本
make報錯:
cd src && make all
make[1]: Entering directory `/usr/local/redis-5.0.0/src'
CC adlist.o
In file included from adlist.c:34:0:
zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory
#include <jemalloc/jemalloc.h>
^
compilation terminated.
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/usr/local/redis-5.0.0/src'
make: *** [all] Error 2
解決辦法:
編輯src/.make-settings里的OPT,改為OPT=-O2 -march=x86-64
3、文件缺失
make報錯:
In file included from adlist.c:34:0:
zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory
#include <jemalloc/jemalloc.h>
^
compilation terminated.
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/usr/local/redis-5.0.0/src'
make: *** [all] Error 2
解決方案:
分別進入redis-stable下的deps下的hiredis、lua 運行make
cd /usr/local/redis-stable/deps
make
cd lua
make
cd /usr/local/redis-stable
make
我也是在遇到問題,站在別人的高度上,解決自己遇到的問題。
報錯提示和解決方案均是正式環境,已經測試無誤可以完美解決。
還是那句老話,環境不同可能遇到的情況不同,如果不能解決還請繼續搜索。