当编译 redis 时出现的报错
首先是因为服务器上没有安装 gcc
给我报了一个 cc 没有找到的错位
这个很好解决
直接安装 gcc 即可
yum -y install gcc
之后重新执行
make && make install
结果出现了新的报错
Error jemalloc/jemalloc.h: No such file or directory
应该是缓存导致的
我在网上发现了有人遇到过同样的问题
[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
执行下面代码即可
make distclean
正文完