错误描述
[root@mysql-rtb-slave redis-4.0.1]# make && make installcd src && make allmake[1]: Entering directory `/usr/local/src/redis-4.0.1/src' CC Makefile.depmake[1]: Leaving directory `/usr/local/src/redis-4.0.1/src'make[1]: Entering directory `/usr/local/src/redis-4.0.1/src' CC adlist.oIn file included from adlist.c:34:0:zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory #include^compilation terminated.make[1]: *** [adlist.o] Error 1make[1]: Leaving directory `/usr/local/src/redis-4.0.1/src'make: *** [all] Error 2
原因分析
在README 有这个一段话。Allocator --------- Selecting a non-default memory allocator when building Redis is done by setting the `MALLOC` environment variable. Redis is compiled and linked against libc malloc by default, with the exception of jemalloc being the default on Linux systems. This default was picked because jemalloc has proven to have fewer fragmentation problems than libc malloc. To force compiling against libc malloc, use: % make MALLOC=libc To compile against jemalloc on Mac OS X systems, use: % make MALLOC=jemalloc
解决办法
[root@mysql-rtb-slave redis-4.0.1]# make MALLOC=libc[root@mysql-rtb-slave redis-4.0.1]# make && make install