• 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
  • 相关阅读:
    js插件-图片椭圆轮播效果
    js-放大镜效果
    vue使用技巧,及遇到的问题
    vue的传参方式和router使用技巧
    关于new Date()的日期格式处理
    图片上传预览
    缓动动画的原理
    input不能输入汉字和负数
    上传格式判断方法
    Vue-cli3.0配置全局less
  • 原文地址:https://www.cnblogs.com/wuxun1997/p/11798603.html
Copyright © 2020-2023  润新知