如题,看了下该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
Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐