Skip to content

Instantly share code, notes, and snippets.

@pcan
Created April 3, 2017 09:16
Show Gist options
  • Save pcan/44cb2177647f029d457facb31da0883f to your computer and use it in GitHub Desktop.
Save pcan/44cb2177647f029d457facb31da0883f to your computer and use it in GitHub Desktop.
Compile Redis with Cygwin

Prerequisites

Install Cygwin with make, gcc & g++. Download Redis tar.gz package, unpack it.

Patch

Edit deps/hiredis/net.c and add the following lines just after the include directives:

/* Cygwin Fix */
#ifdef __CYGWIN__
#define TCP_KEEPCNT 8
#define TCP_KEEPINTVL 150
#define TCP_KEEPIDLE 14400
#endif

Build

Run the following script:

cd deps/
make lua hiredis linenoise

cd ..
make

Credits

Thanks to winse, see this blog entry.

@cromat
Copy link

cromat commented Jul 26, 2018

For newer gcc compilers you need to add following line in net.c file before include directives:
#define _POSIX_C_SOURCE 200112L

@mosynaq
Copy link

mosynaq commented Sep 19, 2018

@pcan,@cromat, Compile succeeded, and I can start redis-serveice.exe, but redis-cli.exe is unable to connect to redis-service.exe. What is it?

$ src/redis-cli.exe
Could not connect to Redis at 127.0.0.1:6379: Name or service not known
Aborted (core dumped)

@cromat
Copy link

cromat commented Jan 31, 2019

@mosynaq You have probably solved your problem by now but the port is maybe used by another service. I am getting everything working with following similar instructions.

@meiry
Copy link

meiry commented Jan 9, 2020

@mosynaq @cromat
i solved it please check troubleshooting section :
https://github.com/meiry/redis5_compiled_for_windows10

@cromat
Copy link

cromat commented Jan 9, 2020

@meiry
Great! I am sure that it will help someone. Also to note, I have tried this before only on Windows 7.

@meiry
Copy link

meiry commented Jan 9, 2020

@cromat
i dont have windows 7 , also this build is as i see it for testing porpeses only .
i dont think it will have problem with windows 7 as cygwin do the wrap but it need to be compiled on windows 7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment