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


  如題,看了下該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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM