1

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?

Diego Barreiro
  • 333
  • 8
  • 22
  • 1
    Possible duplicate of [luaL\_openlib replacement for Lua 5.2](https://stackoverflow.com/questions/19041215/lual-openlib-replacement-for-lua-5-2) – AlgoRythm Dec 07 '17 at 01:47
  • it ran perfectly fine on my machine. Could maybe tell us how you installed socket, and lua? – Ace shinigami Dec 11 '17 at 16:04

1 Answers1

1

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

matthias_h
  • 11,356
  • 9
  • 22
  • 40