Building latest Redis to use in Cygwin

on Tuesday, August 28, 2012
Today I had to use Redis for the first time which doesn’t seem very well supported under Windows at this point. Coming from Linux I try to use Cygwin under Windows as often as I can. So here is what I did to build the latest Redis version (there were some old binaries for download but I wanted to use a newer version). First make sure you have the Cygwin packages “make” and “gcc” installed. Then open a Cygwin terminal and follow the steps under “Installation” but do not run “make” yet. Before you run “make” open the file src/redis.c and add the following block somewhere on top of the file (I have copied it just one line before the #include statement):

This is a manual change which I found in this issue. Finally run “make”. Ignore the warnings. If all goes well, you should have a bunch of new .exe files at the end. redis-benchmark.exe, redis-check-aof.exe, redis-check-dump.exe, redis-cli.exe and redis-server.exe – copy them into the bin folder of your Cygwin installation and restart the terminal. To test execute “redis-cli -h <your-redis-server> -p <your-redis-port> ping” and hopefully get a pong back.


Maurice Henri said...

Thanks for this post.
I didn't manage to build redis for cygwin thought...
I had to add the snippet to debug.c too, and then got :
sentinel.c:1415:13: warning: implicit declaration of function ‘strtoll’
LINK redis-server
cc: unrecognized option '-rdynamic'
cc: unrecognized option '-pthread'
object.o: In function `getLongDoubleFromObject':
/cygdrive/d/UFAPI/redis-2.6.10/src/object.c:432: undefined reference to `_strtold'
collect2: ld returned 1 exit status
Makefile:157: recipe for target `redis-server' failed
make[1]: *** [redis-server] Error 1
make[1]: Leaving directory `/cygdrive/d/UFAPI/redis-2.6.10/src'
Makefile:9: recipe for target `install' failed
make: *** [install] Error 2

Post a Comment