Lua5.3和LuaL_openlib出错

时间:2017-12-07 00:20:39

标签: lua

尝试使用Luaocket和Lua5.3

时出现此错误
  

从文件加载模块'socket.core'时出错   '/usr/local/lib/lua/5.3/socket/core.so':   /usr/local/lib/lua/5.3/socket/core.so:undefined symbol:luaL_openlib

带有演示的控制台输出:

barreeeiroo@Telegram ~/mattata-ai> lua
Lua 5.2.4  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> local socket = require("socket.core")
> ^C⏎                                                                                                                      
barreeeiroo@Telegram ~/mattata-ai> lua5.3
Lua 5.3.3  Copyright (C) 1994-2016 Lua.org, PUC-Rio
> local socket = require("socket.core")
error loading module 'socket.core' from file '/usr/local/lib/lua/5.3/socket/core.so':
        /usr/local/lib/lua/5.3/socket/core.so: undefined symbol: luaL_openlib
stack traceback:
        [C]: in ?
        [C]: in function 'require'
        stdin:1: in main chunk
        [C]: in ?
> ^C⏎                                                                                                                      
barreeeiroo@Telegram ~/mattata-ai> readelf -a /usr/bin/lua | grep openlib
   109: 0000000000018a70   163 FUNC    GLOBAL DEFAULT   15 luaL_openlib@@LUA_5.2
   240: 0000000000018b20   117 FUNC    GLOBAL DEFAULT   15 luaL_openlibs@@LUA_5.2
barreeeiroo@Telegram ~/mattata-ai> readelf -a /usr/bin/lua5.3 | grep openlib
   238: 000000000001b330    85 FUNC    GLOBAL DEFAULT   15 luaL_openlibs@@LUA_5.3

如何让luaL_openlib与Lua5.3一起使用?

1 个答案:

答案 0 :(得分:1)

我也遇到了同样的问题,并通过以下链接解决了这个问题:https://luarocks.org/

我的问题是我使用的是lua 5.3,而我的luarocks正在下载lua 5.1的模块