Openresty和luasocket错误

我正在尝试从openresty加载luasocket lib,但是我收到了一个非常奇怪的错误:

2015/01/25 13:06:38 [error] 10065#0: *5 lua entry thread aborted: runtime error: error loading module 'socket.core' from file '/usr/local/lib/lua/5.1/socket/core.so':
    dlopen(/usr/local/lib/lua/5.1/socket/core.so, 6): Symbol not found: _luaL_prepbuffsize
  Referenced from: /usr/local/lib/lua/5.1/socket/core.so
  Expected in: dynamic lookup

stack traceback:
coroutine 0:
    [C]: in function 'require'
    content_by_lua(nginx.conf:20):4: in function <content_by_lua(nginx.conf:20):1>, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"

使用luarocks安装了luasocket lib,并使用以下设置进行了编译:

./configure --prefix=/usr/local/openresty/luajit \
    --with-lua=/usr/local/openresty/luajit/ \
    --lua-suffix=jit-2.1.0-alpha \
    --with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1

我正在使用通过homebrew安装的lua 5.1版本:

MacBook-Pro-Fedor-2:bin lobster$ lua5.1
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
>

UPD:感谢siffiejoe的帮助。使用标志--lua-version = 5.1 --versioned-rocks-dir编译您的luarocks,然后启动luarocks-5.1而不是luarocks

点赞