如何为lua 5.3构建luasockets

时间:2015-12-16 09:26:36

标签: lua

我尝试使用我在这里下载的库redis-lua:

https://github.com/nrk/redis-lua

它失败了:

Lua 5.3.2  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> require 'redis'
table: 0x84caea0
> r = require 'redis'
> r.connect('127.0.0.1',1234)
./redis.lua:791: module 'socket' not found:
    no field package.preload['socket']
    no file '/usr/local/share/lua/5.3/socket.lua'
    no file '/usr/local/share/lua/5.3/socket/init.lua'
    no file '/usr/local/lib/lua/5.3/socket.lua'
    no file '/usr/local/lib/lua/5.3/socket/init.lua'
    no file './socket.lua'
    no file './socket/init.lua'
    no file '/usr/local/lib/lua/5.3/socket.so'
    no file '/usr/local/lib/lua/5.3/loadall.so'
    no file './socket.so'

redis-lua文档建议使用http://w3.impa.br/~diego/software/luasocket/

这会引导我进入以下页面:http://files.luaforge.net/releases/luasocket/luasocket/luasocket-2.0.2/luasocket-2.0.2.tar.gz

构建这些来源会出现以下错误:

debian@debian:~/luasocket-2.0.2$ make install
cd src; make all
make[1]: Entering directory `/home/debian/luasocket-2.0.2/src'
gcc  -DLUASOCKET_DEBUG  -pedantic -Wall -O2 -fpic   -c -o luasocket.o luasocket.c
In file included from luasocket.c:31:
auxiliar.h:38: error: expected declaration specifiers or ‘...’ before ‘luaL_reg’
luasocket.c:50: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mod’
luasocket.c:60: warning: ISO C does not allow extra ‘;’ outside of a function
luasocket.c:62: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘func’
luasocket.c:66: warning: ISO C does not allow extra ‘;’ outside of a function

请提出如何为lua 5.3添加套接字支持。

0 个答案:

没有答案