cd src && make all
make[1]: Entering directory `/root/redis-4.0.14/src'
CC Makefile.dep
make[1]: Leaving directory `/root/redis-4.0.14/src'
make[1]: Entering directory `/root/redis-4.0.14/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 `/root/redis-4.0.14/src'
make: *** [all] Error 2
上面抛出 jemalloc 的原因是 jemalloc 重载了 Linux 下的 ANSI C 的 malloc 和 free 函数。解决办法:make时添加参数,如下:
make MALLOC=libc