linux安裝redis時報collect2: fatal error: cannot find 'ld'和In file included from adlist.c:34:0:

  如題,看了下該ld命令所在文件:redis

[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是一個軟鏈接,並且該軟鏈接一直在閃爍:centos

[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:spa

[root@centos redis-4.0.14]# cd /etc/alternatives/
[root@centos alternatives]# ll
total 0

  解決:換個好的環境,發現原來該軟鏈接是指向/usr/bin/ld.bfdcode

 

[root@centosalternatives]# ll
total 0
lrwxrwxrwx 1 root root 15 May 22 21:38 ld -> /usr/bin/ld.bfd

 

  回到失敗環境/etc/alternatives目錄,建立軟鏈接:blog

[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,出來另外一個提示:io

[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
相關文章
相關標籤/搜索