Skip to content

Instantly share code, notes, and snippets.

@toshiyukino
Last active December 1, 2016 14:09
Show Gist options
  • Save toshiyukino/e9b71eccb002c23346c49d5ede9d07ae to your computer and use it in GitHub Desktop.
Save toshiyukino/e9b71eccb002c23346c49d5ede9d07ae to your computer and use it in GitHub Desktop.
redisをwindowsでコンパイル

RedisをWindowsでコンパイル

64bit用は配布されているけど32bit用がないのでBuildできるか試してみたい。

mingw32ではうまくいかないのでmsys2上でやってみる。

$ wget http://download.redis.io/redis-stable.tar.gz
$ tar xzf redis-stable.tar.gz
$ cd redis-stable
$ make

https://redis.io/download にも書いてる。

ん?うまくいかない。

cc: エラー: ../deps/hiredis/libhiredis.a: No such file or directory
cc: エラー: ../deps/lua/src/liblua.a: No such file or directory
cc: エラー: ../deps/geohash-int/geohash.o: No such file or directory
cc: エラー: ../deps/geohash-int/geohash_helper.o: No such file or directory

その他のライブラリは別途compileする必要があるっぽい

$ cd deps/
$ make hiredis 
net.c: 関数 ‘redisKeepAlive’ 内:
net.c:143:37: エラー: ‘TCP_KEEPIDLE’ が宣言されていません (この関数内での最初の使用)
     if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &val, sizeof(val)) < 0) {
                                     ^
net.c:143:37: 備考: 未宣言の識別子は出現した各関数内で一回のみ報告されます
net.c:150:37: エラー: ‘TCP_KEEPINTVL’ が宣言されていません (この関数内での最初の使用)
     if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &val, sizeof(val)) < 0) {
                                     ^
net.c:156:37: エラー: ‘TCP_KEEPCNT’ が宣言されていません (この関数内での最初の使用)
     if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, &val, sizeof(val)) < 0) {
                                     ^
make[1]: *** [Makefile:118: net.o] エラー 1

ん?またエラー?

$ vim hiredis/net.h

以下を適当に追加(最後?)

#define TCP_KEEPCNT 8
#define TCP_KEEPINTVL 150
#define TCP_KEEPIDLE 14400

再度、make

$ make hiredis 

できた。引き続き実行

$ make lua
$ make geohash-int
$ make linenoise
$ cd ..
$ make
Hint: It's a good idea to run 'make test' ;)

できた!

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