make & make install安装Redis时失败报错
问题描述: 今天在安装redis服务时,执行make & make install命令后出现下面这个错误 zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory 解决...
问题描述:
今天在安装redis服务时,执行make & make install命令后出现下面这个错误
zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory
解决办法:
运行下面这个命令:
make MALLOC=libc
再执行make & make install就可以正常安装redis了。
原因分析:
README 写到:
AllocatorSelecting a non-default memory allocator when building Redis is done by settingthe "MALLOC*environment variable. Redis is compiled and linked against libcmalloc by default, with the exception of jemalloc being the default on Linuxsystems. This default was picked because iemalloc has proven to have fewerfragmentation problems than libc malloc.To force compiling against libc malloc, use:% make MALLOC=libcTo compile against jemalloc on Mac OS X systems, use!% make MALLOC=jemalloc说关于分配器allocator,如果有MALLOC 这个 环境变量,会有用这个环境变量的 去建立Redis.而目libc 并不是默认的分配器,默认的是 iemalloc,因为iemalloc 被证明 有更少的fragmentation problems 比libc.但是如果你又没有jemalloc 而只有 libc 当然 make 出错。 所以加这么一个参数