如题,看了下该ld命令所在文件:
[root@centos redis-4.0.14]# whereis ld ld: /usr/bin/ld.gold /usr/bin/ld /usr/bin/ld.bfd /usr/share/man/man1/ld.1.gz
发现ld是一个软连接,而且该软连接一直在闪烁:
[root@centos redis-4.0.14]# ll /usr/bin/ld* lrwxrwxrwx. 1 root root 20 Mar 23 2017 /usr/bin/ld -> /etc/alternatives/ld -rwxr-xr-x. 1 root root 873928 Aug 8 2016 /usr/bin/ld.bfd -rwxr-xr-x. 1 root root 5302 Aug 11 2016 /usr/bin/ldd -rwxr-xr-x. 1 root root 4859448 Aug 8 2016 /usr/bin/ld.gold
到该软连接目录下,发现软连接失效,已不存在ld:
[root@centos redis-4.0.14]# cd /etc/alternatives/ [root@centos alternatives]# ll total 0
解决:换个好的环境,发现原来该软连接是指向/usr/bin/ld.bfd
[root@centosalternatives]# ll total 0 lrwxrwxrwx 1 root root 15 May 22 21:38 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. 1 root root 20 Mar 23 2017 /usr/bin/ld -> /etc/alternatives/ld -rwxr-xr-x. 1 root root 873928 Aug 8 2016 /usr/bin/ld.bfd -rwxr-xr-x. 1 root root 5302 Aug 11 2016 /usr/bin/ldd -rwxr-xr-x. 1 root root 4859448 Aug 8 2016 /usr/bin/ld.gold
现在软连接不闪了,再次编译redis,出来另一个提示:
[root@centos redis-4.0.14]# make cd src && make all make[1]: Entering directory `/root/redis/redis-4.0.14/src' CC Makefile.dep make[1]: Leaving directory `/root/redis/redis-4.0.14/src' make[1]: Entering directory `/root/redis/redis-4.0.14/src' 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 `/root/redis/redis-4.0.14/src' make: *** [all] Error 2
编译命令使用如下语句,改变redis的分配器即可:
[root@centos redis-4.0.14]# make MALLOC=libc