如题,看了下该ld命令所在文件:

[root@centos redis-4.0.]# whereis ld
ld: /usr/bin/ld.gold /usr/bin/ld /usr/bin/ld.bfd /usr/share/man/man1/ld..gz

  发现ld是一个软连接,而且该软连接一直在闪烁:

[root@centos redis-4.0.]# ll /usr/bin/ld*
lrwxrwxrwx. root root Mar /usr/bin/ld -> /etc/alternatives/ld
-rwxr-xr-x. root root Aug /usr/bin/ld.bfd
-rwxr-xr-x. root root Aug /usr/bin/ldd
-rwxr-xr-x. root root Aug /usr/bin/ld.gold

  到该软连接目录下,发现软连接失效,已不存在ld:

[root@centos redis-4.0.]# cd /etc/alternatives/
[root@centos alternatives]# ll
total

  解决:换个好的环境,发现原来该软连接是指向/usr/bin/ld.bfd

[root@centosalternatives]# ll
total
lrwxrwxrwx root root May : ld -> /usr/bin/ld.bfd

  回到失败环境/etc/alternatives目录,创建软连接:

[root@centos alternatives]# touch ld
[root@centos alternatives]# ln -s /usr/bin/ld.bfd ld
[root@centos alternatives]# ll /usr/bin/ld*
lrwxrwxrwx. root root Mar /usr/bin/ld -> /etc/alternatives/ld
-rwxr-xr-x. root root Aug /usr/bin/ld.bfd
-rwxr-xr-x. root root Aug /usr/bin/ldd
-rwxr-xr-x. root root Aug /usr/bin/ld.gold

  现在软连接不闪了,再次编译redis,出来另一个提示:

[root@centos redis-4.0.]# make
cd src && make all
make[]: Entering directory `/root/redis/redis-4.0./src'
CC Makefile.dep
make[]: Leaving directory `/root/redis/redis-4.0./src'
make[]: Entering directory `/root/redis/redis-4.0./src'
CC adlist.o
In file included from adlist.c:::
zmalloc.h::: fatal error: jemalloc/jemalloc.h: No such file or directory
#include <jemalloc/jemalloc.h>
^
compilation terminated.
make[]: *** [adlist.o] Error
make[]: Leaving directory `/root/redis/redis-4.0./src'
make: *** [all] Error

  编译命令使用如下语句,改变redis的分配器即可:

[root@centos redis-4.0.]# make MALLOC=libc
05-24 09:03