代码之家  ›  专栏  ›  技术社区  ›  mxbi

编译redis的hiredis依赖项时出现奇怪的错误:cc:错误:x86\u 64:没有这样的文件或目录

  •  1
  • mxbi  · 技术社区  · 7 年前

    我正在Ubuntu 16.04上编译Redis 4.0.9(最新版本)。在redis目录中运行make时,我得到以下输出:

    cd src && make all
    make[1]: Entering directory '/user/HS104/m09170/redis/redis-4.0.9/src'
        CC Makefile.dep
    rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html Makefile.dep dict-benchmark
    (cd ../deps && make distclean)
    make[2]: Entering directory '/user/HS104/m09170/redis/redis-4.0.9/deps'
    (cd hiredis && make clean) > /dev/null || true
    (cd linenoise && make clean) > /dev/null || true
    (cd lua && make clean) > /dev/null || true
    (cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
    (rm -f .make-*)
    make[2]: Leaving directory '/user/HS104/m09170/redis/redis-4.0.9/deps'
    (rm -f .make-*)
    echo STD=-std=c99 -pedantic -DREDIS_STATIC='' >> .make-settings
    echo WARN=-Wall -W -Wno-missing-field-initializers >> .make-settings
    echo OPT=-O2 >> .make-settings
    echo MALLOC=jemalloc >> .make-settings
    echo CFLAGS= >> .make-settings
    echo LDFLAGS= >> .make-settings
    echo REDIS_CFLAGS= >> .make-settings
    echo REDIS_LDFLAGS= >> .make-settings
    echo PREV_FINAL_CFLAGS=-std=c99 -pedantic -DREDIS_STATIC='' -Wall -W -Wno-missing-field-initializers -O2 -g -ggdb   -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -DUSE_JEMALLOC -I../deps/jemalloc/include >> .make-settings
    echo PREV_FINAL_LDFLAGS=  -g -ggdb -rdynamic >> .make-settings
    (cd ../deps && make hiredis linenoise lua jemalloc)
    make[2]: Entering directory '/user/HS104/m09170/redis/redis-4.0.9/deps'
    (cd hiredis && make clean) > /dev/null || true
    (cd linenoise && make clean) > /dev/null || true
    (cd lua && make clean) > /dev/null || true
    (cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
    (rm -f .make-*)
    (echo "" > .make-cflags)
    (echo "" > .make-ldflags)
    MAKE hiredis
    cd hiredis && make static
    make[3]: Entering directory '/user/HS104/m09170/redis/redis-4.0.9/deps/hiredis'
    cc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb x86_64 net.c
    cc: error: x86_64: No such file or directory
    Makefile:156: recipe for target 'net.o' failed
    make[3]: *** [net.o] Error 1
    make[3]: Leaving directory '/user/HS104/m09170/redis/redis-4.0.9/deps/hiredis'
    Makefile:45: recipe for target 'hiredis' failed
    make[2]: *** [hiredis] Error 2
    make[2]: Leaving directory '/user/HS104/m09170/redis/redis-4.0.9/deps'
    Makefile:170: recipe for target 'persist-settings' failed
    make[1]: [persist-settings] Error 2 (ignored)
        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
    compilation terminated.
    Makefile:228: recipe for target 'adlist.o' failed
    make[1]: *** [adlist.o] Error 1
    make[1]: Leaving directory '/user/HS104/m09170/redis/redis-4.0.9/src'
    Makefile:6: recipe for target 'all' failed
    make: *** [all] Error 2
    

    问题似乎与依赖性有关。如果我进入 deps 文件夹并手动逐个编译依赖项,它们都成功了(包括jemalloc),但hiredis除外,它提供了以下输出:

    user@tefnut:~/redis/redis-4.0.9/deps/hiredis$ make
    cc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb x86_64 net.c
    cc: error: x86_64: No such file or directory
    Makefile:156: recipe for target 'net.o' failed
    make: *** [net.o] Error 1
    

    我试过 make distclean 没有成功。

    2 回复  |  直到 7 年前
        1
  •  1
  •   gae123 Hunter    6 年前

    解决方案正在运行:

    unset ARCH 和/或 unset TARGET_ARCH

    之后,雇工们毫无怨言地进行了编辑。我不确定 为什么? 这是可行的,所以如果其他人知道为什么会有不同,我很好奇。

        2
  •  -1
  •   krishna chandak    6 年前

    在创建依赖项之前安装build essential,gcc需要安装在那里。

    sudo apt get install build essential软件