Error loading module undefined symbol: luaL_setfuncs

非 Y 不嫁゛ 提交于 2019-12-06 14:09:38

Never use -llua when building Lua modules. The Lua interpreter itself is already linked with liblua and satisfies those symbols when the module is loaded. Linking your module against liblua is clashing with the interpreter.

I think I found the problem (not yet the solution): Mysql-proxy runs internally an embended lua library.

mysql-proxy -V

gives as result

mysql-proxy 0.8.1
  chassis: mysql-proxy 0.8.1
  glib2: 2.30.2
  libevent: 2.0.19-stable
  LUA: Lua 5.1.4
    package.path: /usr/lib/mysql-proxy/lua/?.lua
    package.cpath: /usr/lib/mysql-proxy/lua/?.so
-- modules
  admin: 0.8.1
  proxy: 0.8.1

So I am running the wrong lua version. I think that this explains the luaL_setfuncs error. I have seen that even the 0.8.4 version includes this version of lua, so I will have to rewrite the C library.

the final code of the module ends like this (and runs!!!):

static const struct luaL_Reg my_luacall[] = {
    {"trasnquery", trasnquery},
    {"fun2", function_2},
    {NULL, NULL}
};

int luaopen_luacall(lua_State* l)
{
    luaL_register(l, "luacall", my_luacall);
    return 1;
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!