准备环境
-
下载cygwin64工具,用于下载所需依赖
下载地址:https://www.cygwin.com/如:gcc、make、zip、unzip
依赖安装不全不用担心之后可以再用此工具补充安装 -
集成开发工具:clion
步骤
-
修改部分文件因windows环境导致的编译错误
-
src\mkreleasehdr.sh 脚本文件需要将windows换行符修改为unix的换行符(LF),
不然会报错
CC release.o
release.c:37:10: fatal error: release.h: No such file or directory
37 | #include “release.h”
| ^~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:368: release.o] Error 1
make[1]: Leaving directory ‘/cygdrive/d/workspace/redis/src’
make: *** [Makefile:6: all] Error 2
-
错误2
debug.c:1751:5: error: unknown type name 'Dl_info' 1751 | Dl_info info; | ^~~~~~~ debug.c:1761:13: warning: implicit declaration of function 'dladdr'; did you mean 's_addr'? [-Wimplicit-function-declaration] 1761 | if (dladdr((void*)target, &info) != 0 && info.dli_sname != NULL) { | ^~~~~~
在src\debug.c这个源码中引用,它声明在#include <dlfcn.h>头文件中,此头文件在你cygwin64安装目录的\usr\include\dlfcn.h ,将里面的#if __GNU_VISIBLE注释掉(记得修改完后保存)
-
-
最后在项目根路径执行make即可
-
在src目录下有可执行文件