1

我正在尝试从 openresty 加载 luasocket 库,但是,我遇到了非常奇怪的错误:

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"

luasocket 库是使用 luarocks 安装的,它是使用以下设置编译的:

./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

我正在使用使用自制软件安装的 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

4

0 回答 0