Diego Barreiro
Diego Barreiro

Reputation: 343

Error with Lua5.3 and LuaL_openlib

I'm getting this error when trying to require LuaSocket with Lua5.3

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


Console Output with demonstration:

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

How can I make luaL_openlib to work with Lua5.3?

Upvotes: 1

Views: 2150

Answers (1)

Flavio de Moraes
Flavio de Moraes

Reputation: 11

I faced the same issue and solved with this link: https://luarocks.org/

My problem is that I was using lua 5.3 and my luarocks was downloading modules for lua 5.1

Upvotes: 1

Related Questions