Reputation: 920
I am attempting to add load the socket library in a Lupa runtime.
I installed socket with Luarocks, so I needed to append the necessary paths.
>>> import lupa
>>> sys.setdlopenflags(orig_dlflags)
>>> lua = lupa.LuaRuntime()
>>> lua.execute("package.cpath = package.cpath .. ';/root/.luarocks/lib/lua/5.3/?.so;/usr/local/lib/lua/5.3/?.so;/usr/local/lib/lua/5.3/loadall.so;./?.so'")
>>> lua.execute(" package.path = package.path .. ';/root/.luarocks/share/lua/5.3/?.lua;/root/.luarocks/share/lua/5.3/?/init.lua;/usr/local/share/lua/5.3/?.lua;/usr/local/share/lua/5.3/?/init.lua;/usr/local/lib/lua/5.3/?.lua;/usr/local/lib/lua/5.3/?/init.lua;./?.lua;./?/init.lua'")
>>> lua.require("socket")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "lupa/_lupa.pyx", line 268, in lupa._lupa.LuaRuntime.require (lupa/_lupa.c:4683)
File "lupa/_lupa.pyx", line 1245, in lupa._lupa.call_lua (lupa/_lupa.c:17287)
File "lupa/_lupa.pyx", line 1254, in lupa._lupa.execute_lua_call (lupa/_lupa.c:17400)
File "lupa/_lupa.pyx", line 1207, in lupa._lupa.raise_lua_error (lupa/_lupa.c:16746)
lupa._lupa.LuaError: 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: lua_rotate
A similar issue is mentioned here but the proposed solution does not seem to work for me (I am running Ubuntu):
Linker Error Lunatic Python lua.require('socket') -> undefined symbol: lua_getmetatable
From my understanding, there is a linking problem to liblua5.3.so?
Any help would be greatly appreciated.
Thanks, Alex
Upvotes: 1
Views: 593
Reputation: 920
It turns out that Lupa is built against Lua 5.2.
I was including paths to 5.3 modules - it appears using 5.2 and installing the sockets module in 5.2 fixed my problem.
Upvotes: 1