February 7, 2017
·
redis
redis3.2.7安装出现的小问题
编译redis3.2.7的时候,make出现以下错误。
../deps/jemalloc/lib/libjemalloc.a(nstime.o): In function `nstime_get':
/usr/local/redis-3.2.7/deps/jemalloc/src/nstime.c:120: undefined reference to `clock_gettime'
collect2: ld returned 1 exit status
make[1]: *** [redis-server] Error 1
make[1]: Leaving directory `/usr/local/redis-3.2.7/src'
make: *** [all] Error 2
找了一下资料,发现是类库问题
On older Linux systems, clock_gettime() is in librt rather than libc.
也就是说在版本比较老的linux系统中,clock_gettime这个函数是在librt库中的函数。
redis3.2.7调用的可能是新版的,所以需要在Makefile中指定。
.修改 ../redis-3.2.7/src/Makefile
改为 FINAL_LIBS+= ../deps/jemalloc/lib/libjemalloc.a
FINAL_LIBS+= ../deps/jemalloc/lib/libjemalloc.a -lrt