我正在尝试在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文件夹并手动一个接一个地编译依赖关系,除了hiredis之外,它们都成功(包括jemalloc),它给出以下输出:
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失败。

最佳答案

解决方案正在运行:
unset ARCH和/或unset TARGET_ARCH
之后,hiredis会毫无抱怨地进行汇编。我不确定为什么能奏效,所以如果有人知道为什么会有所作为,我很好奇。

关于makefile - 奇怪的失败,编译了redis的hiredis依赖关系:cc:错误:x86_64:没有这样的文件或目录,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49545175/

10-12 21:24