尝试在Lua5.3中使用LuaSocket时出现此错误
错误从文件加载模块'socket.core''/usr/local/lib/lua/5.3/socket/core.so':/usr/local/lib/lua/5.3/socket/core.so:未定义符号: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一起使用?
我面临相同的问题,并通过以下链接解决:https://luarocks.org/
我的问题是我正在使用lua 5.3,而我的luarocks正在下载lua 5.1的模块