Closed ingydotnet closed 7 years ago
The fix should be
#ifndef u_char
#define u_char unsigned char
#endif
@doujiang24 OK, I've tested the following patch on my Mac OS X and it builds and passes the test suite now:
diff --git a/Makefile b/Makefile
index 98a57c8..cd8f2bf 100644
--- a/Makefile
+++ b/Makefile
@@ -12,11 +12,7 @@ OS := $(shell uname)
SRC := chash.c
OBJ := $(SRC:.c=.o)
-ifeq ($(OS), Darwin)
-C_SO_NAME := libchash.dylib
-else
C_SO_NAME := libchash.so
-endif
CFLAGS := -Wall -O3 -flto -g -DFP_RELAX=0 -DDEBUG
THE_CFLAGS := $(CFLAGS) -fPIC -MMD -fvisibility=hidden
diff --git a/chash.c b/chash.c
index 2c7bf3b..1d13dd3 100644
--- a/chash.c
+++ b/chash.c
@@ -4,6 +4,10 @@
#include "chash.h"
+#ifndef u_char
+#define u_char unsigned char
+#endif
+
#define crc32_final(crc) \
crc ^= 0xffffffff
@ingydotnet @agentzh Fixed in https://github.com/doujiang24/lua-resty-balancer/commit/d058c569d5434cd3ef3331047793c9c2a7b5151a, thanks a lot :)