Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lzmq not found by Lua #69

Open
martindehmel94 opened this issue Feb 2, 2021 · 6 comments
Open

Lzmq not found by Lua #69

martindehmel94 opened this issue Feb 2, 2021 · 6 comments

Comments

@martindehmel94
Copy link

I have some trouble integrating lzmq into my lua script, which is called by the Lua/C++ API.
I use Lua version 5.4 under Ubuntu 20.04.

This is my Lua Code:

#!/usr/local/bin/lua

local function test()
	local lzmq = require "lzmq"  
end

local ok, err_msg = pcall(test, 42)
if not ok then
    print(err_msg)
end

This prints the following error message:
error loading module 'lzmq' from file '/usr/local/lib/lua/5.4/lzmq.so':
/usr/local/lib/lua/5.4/lzmq.so: undefined symbol: lua_checkstack

lzmq is located under /usr/local/lib/lua/5.4/.

I use the following C++ code to load and execute my Lua file:

#include <iostream>
#include <lua.hpp>

using namespace std;

lua_State* L;

int main()
{
	L = luaL_newstate();
	luaL_openlibs(L);
        luaL_dofile(L, "controller.lua");
        lua_close(L);
        cout << "Error? " << error << endl;
}

What can be the reason for this error?

@martindehmel94
Copy link
Author

Seems like I could resolve the issue by switching Lua to version 5.3.6.
I guess it is a compatibility issue with the newest Lua version (5.4.2), and some functions/symbols were removed from Lua.
This should explain the error message discussed above.

@moteus
Copy link
Member

moteus commented Feb 3, 2021

How did you compile lzmq library? I did not test lzmq with Lua 5.4, but I expect it should work. Also, I believe that lua_checkstack stay intact in the Lua 5.4.

@martindehmel94
Copy link
Author

I think I installed it via luarocks and moved the .so files manually to /usr/local/lib/lua/5.3. This is included in my cpath, where Lua 5.3.6 looks for modules. This way it worked for Lua 5.3, but not for 5.4...

@moteus
Copy link
Member

moteus commented Feb 3, 2021

I think I installed it via luarocks and moved the .so files manually to

This should not work for any Lua module written on C (or ny other compiled language)
Lua module have to build against correct Lua version.
If you whant to try lzm wit the Lua5.4 you can download rockspec file an updete version in there. There high chance that it works. Ofcourse you have to have LuaRocks configured for Lua 5.4

@martindehmel94
Copy link
Author

Okay, thank your for your assistance so far. I'm happy at the moment, maybe I will try it with 5.4 later again.

@lemonci
Copy link

lemonci commented Aug 24, 2021

apt-get install libzmq3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants