forhappy / zklua

Lua binding of apache zookeeper.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to install zklua on macosx?

wbdu opened this issue · comments

localhost:zklua steven$ make
gcc -c pkg-config --cflags lua -fPIC -O2 zklua.c
zklua.c:28:1: error: unknown type name '_'
_
^
In file included from zklua.c:29:
In file included from ./zklua.h:24:
In file included from /usr/local/include/lua.h:12:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/include/stdarg.h:30:1: error: expected identifier or
'('
typedef __builtin_va_list va_list;
^
In file included from zklua.c:29:
./zklua.h:28:10: fatal error: 'zookeeper/zookeeper.h' file not found

include <zookeeper/zookeeper.h>

     ^

3 errors generated.
make: *** [zklua.o] Error 1

commented

你需要删除zklua.c中的第28行'_'。

Thks,删除掉后编译通过了。
再请教一个问题,我想用luajit编译,应该如何修改MakeFile呢?

commented

只需要修改Makefile中的LUA_INC_DIR = /usr/local/include/luajit-2.0为你自己的luajit头文件路径即可

:( 没找到LUA_INC_DIR,只有:
LUA_LIB_DIR = /usr/local/Cellar
LUA_VERSION = lua
LUA_VERSION_NUMBER = 5.2.4_1

作者是用pkg-config搞的。我不知该如何修改:(
CC = gcc
CFLAGS = pkg-config --cflags $(LUA_VERSION) -fPIC -O2 #-Wall
INSTALL_PATH = $(shell pkg-config $(LUA_VERSION) --variable=libdir)/$(LUA_VERSION)/$(LUA_VERSION_NUMBER)

commented

LUA_INC_DIR = /usr/local/include/luajit-2.0
CFLAGS = -I$(LUA_INC_DIR) -fPIC -O2 -Wall

我是这样修改的

谢谢啦,那上面那个INSTALL_PATH应该如何修改呢?
后面用到了

install: zklua.so
ifeq ($(OS_NAME), Darwin)
install zklua.so $(INSTALL_PATH)/zklua.so
else
install -D -s zklua.so $(INSTALL_PATH)/zklua.so
endif

我改好了,再次感谢。

在openresty环境下运行实例,直接导致nginx进程崩溃了。

commented

我也有这个问题,但是作者一直没回应,你先看下pull request把其他的BUG改掉