makefile - 如何在 Windows-10 上编译 REDIS 5.0.5,make 出错

标签 makefile redis compilation windows-10 mingw-w64

Redis下载5.0.5 cd 到src目录 制作

这肯定对其他人也有效。关于如何解决这个问题有任何想法/提示吗?

简短版本:

net.c中...

make[3]: Entering directory '/cygdrive/c/Users/pmoran/Downloads/redis-5.0.5/deps/hiredis'
cc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb  net.c

net.c:270:21: error: storage size of ‘hints’ isn’t known
 struct addrinfo hints, *servinfo, *bservinfo, *p, *b;
                 ^~~~~

及以后

net.c:337:40: error: dereferencing pointer to incomplete type ‘struct addrinfo’
 for (p = servinfo; p != NULL; p = p->ai_next) {
                                    ^~

然后

make[3]: *** [Makefile:156: net.o] Error 1
make[3]: Leaving directory '/cygdrive/c/Users/pmoran/Downloads/redis-5.0.5/deps/hiredis'
make[2]: *** [Makefile:46: hiredis] Error 2
make[2]: Leaving directory '/cygdrive/c/Users/pmoran/Downloads/redis-5.0.5/deps'

最后

cc: error: ../deps/hiredis/libhiredis.a: No such file or directory
cc: error: ../deps/lua/src/liblua.a: No such file or directory
make[1]: *** [Makefile:219: redis-server] Error 1
make[1]: Leaving directory '/cygdrive/c/Users/pmoran/Downloads/redis-5.0.5/src'
make: *** [Makefile:6: all] Error 2

最佳答案

我遇到了同样的问题,我发现最好的解决方案是使用旧版本的 redis。 Redis 3.2.13 最近更新(2019 年 3 月),因此它具有我需要的所有功能。如果您使用它,则必须在“include”语句之后将以下内容添加到 redis-3.2.13/deps/hiredis/net.c 中:

    #ifdef __CYGWIN__
    #define TCP_KEEPCNT 8
    #define TCP_KEEPINTVL 150
    #define TCP_KEEPIDLE 14400
    #endif

之后我就可以从根目录运行 make 了:

make distclean
make

这是基于 this github 对话。

希望这有帮助!

关于makefile - 如何在 Windows-10 上编译 REDIS 5.0.5,make 出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56498250/

相关文章:

makefile - <命令行> : error : in makefiles

unix - ar 在现有的 .a 文件上?

python - Redis keyspace notifications - 获取键和值的变化

c++ - 每次在 Visual Studio 2015 中编译项目时是否都必须链接 .lib 文件?

android - 如何使用平台和构建工具在 RHEL linux 上安装 Android sdk

node.js - 生成文件: How to runs 2 distinct shells?

c - 如何在 Mac OS X 终端上使用 make 编译 C 程序

Redis 桌面对 libicu52 for ubuntu12.04 的依赖

azure - Azure 上的 Redis - 键突然停止增加,命中和未命中为零

java - 如何防止类型删除?