错误jemalloc/jemalloc.h:进行Redis时没有这样的文件或目录 [英] Error jemalloc/jemalloc.h: No such file or directory when making Redis
问题描述
我尝试设置我的Redis服务器,当执行make命令时,出现错误:"jemalloc/jemalloc.h:制作Redis时没有这样的文件或目录",我已经尝试了所有可以找到的步骤,例如make distclean或使MALLOC = libc. 我正在使用CentOS,它正在我的另一台Ubuntu服务器上工作.
I'm try to setup my Redis server, when execute make command, got error: "jemalloc/jemalloc.h: No such file or directory when making Redis", I have tried all steps I can find, such as make distclean or make MALLOC=libc. I'm working on CentOS, it is working on my another Ubuntu server.
系统信息: Linux ec4t02229 3.10.0-514.10.2.el7.x86_64#1 SMP Fri Mar 3 00:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
System information: Linux ec4t02229 3.10.0-514.10.2.el7.x86_64 #1 SMP Fri Mar 3 00:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
下面是我的输出,任何建议将不胜感激.
Below is my output, any suggestion would be appreciated.
[root@ec4t02229 redis-4.0.2]# make
cd src && make all
make[1]: Entering directory `/home/fenxiaop/redis-4.0.2/src'
CC Makefile.dep
make[1]: Leaving directory `/home/fenxiaop/redis-4.0.2/src'
make[1]: Entering directory `/home/fenxiaop/redis-4.0.2/src'
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html Makefile.dep dict-benchmark
(cd ../deps && make distclean)
make[2]: Entering directory `/home/fenxiaop/redis-4.0.2/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
make[2]: Leaving directory `/home/fenxiaop/redis-4.0.2/deps'
(rm -f .make-*)
echo STD=-std=c99 -pedantic -DREDIS_STATIC='' >> .make-settings
echo WARN=-Wall -W -Wno-missing-field-initializers >> .make-settings
echo OPT=-O2 >> .make-settings
echo MALLOC=jemalloc >> .make-settings
echo CFLAGS= >> .make-settings
echo LDFLAGS= >> .make-settings
echo REDIS_CFLAGS= >> .make-settings
echo REDIS_LDFLAGS= >> .make-settings
echo PREV_FINAL_CFLAGS=-std=c99 -pedantic -DREDIS_STATIC='' -Wall -W -Wno-missing-field-initializers -O2 -g -ggdb - I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -DUSE_JEMALLOC -I../deps/jemalloc/include >> .make-settings
echo PREV_FINAL_LDFLAGS= -g -ggdb -rdynamic >> .make-settings
(cd ../deps && make hiredis linenoise lua jemalloc)
make[2]: Entering directory `/home/fenxiaop/redis-4.0.2/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
(echo "" > .make-cflags)
(echo "" > .make-ldflags)
MAKE hiredis
cd hiredis && make static
make[3]: Entering directory `/home/fenxiaop/redis-4.0.2/deps/hiredis'
cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb x86_64 net.c
cc: error: x86_64: No such file or directory
make[3]: *** [net.o] Error 1
make[3]: Leaving directory `/home/fenxiaop/redis-4.0.2/deps/hiredis'
make[2]: *** [hiredis] Error 2
make[2]: Leaving directory `/home/fenxiaop/redis-4.0.2/deps'
make[1]: [persist-settings] Error 2 (ignored)
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 `/home/fenxiaop/redis-4.0.2/src'
make: *** [all] Error 2
推荐答案
在完成Redis构建后选择一个非默认的内存分配器 通过设置
MALLOC
环境变量. Redis被编译并 默认情况下,与libc malloc链接,但jemalloc除外 是Linux系统上的默认设置.选择该默认值是因为 与libc相比,jemalloc的碎片问题更少 malloc.
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.
要强制针对libc malloc进行编译,请使用:
To force compiling against libc malloc, use:
% make MALLOC=libc
要在Mac OS X系统上针对jemalloc进行编译,请使用:
To compile against jemalloc on Mac OS X systems, use:
% make MALLOC=jemalloc
来源: https://github.com/redis/redis /blob/6.0/README.md#allocator
这篇关于错误jemalloc/jemalloc.h:进行Redis时没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!