redis错误error: jemalloc/jemalloc.h分析解决

安装redis-2.6.6过程中遇到一些错误,这里总结分享出来!

make错误描述


[root@cachedb redis-2.6.6]# make
cd src && make all
make[1]: Entering directory `/usr/local/src/redis-2.6.6/src'
CC adlist.o
在包含自 adlist.c:34 的文件中:
zmalloc.h:50:31: 错误:jemalloc/jemalloc.h:没有那个文件或目录
zmalloc.h:55:2: 错误:#error "Newer version of jemalloc required"
make[1]: *** [adlist.o] 错误 1
make[1]: Leaving directory `/usr/local/src/redis-2.6.6/src'
make: *** [all] 错误 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
上面是说关于分配器allocator, 如果有MALLOC  这个环境变量,会有用这个环境变量的 去建立Redis。
而且libc 并不是默认的分配器,默认的是 jemalloc, 因为jemalloc 被证明有更少的 fragmentation problems 比libc。但是如果你又没有jemalloc 而只有 libc 当然 make 出错。 所以我们需要加一个参数。

解决方法


make MALLOC=libc
我是打杂的!遇到的错误总结,分享笔记!

0 个评论

要回复文章请先登录注册