如题,看了下该ld命令所在文件:
[root@centos redis-3.2.11]# 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-3.2.11]# 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-3.2.11]# 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]# ls -s /usr/bin/ld.bfd ld 0 ld 860 /usr/bin/ld.bfd [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成功。