Bug #24777 gui-common build fails with Lua 5.1.1
Submitted: 2 Dec 2006 15:44 Modified: 13 Dec 2006 0:10
Reporter: [ name withheld ] Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Workbench Preview Severity:S1 (Critical)
Version:5.0r6 OS:Linux (linux ubuntu edgy eft)
Assigned to: CPU Architecture:Any

[2 Dec 2006 15:44] [ name withheld ]
Description:
This bugs has been reported previously #22663, however the version is 5.0r3. I'm using the latest mysql gui tools 5.0r6 with lua 5.1.1 and build failed.

I had to specify the full path of lua eventhough the lib and include is there.

./configure --enable-grt --enable-canvas --with-lua-includes=/usr/local/include --with-lua-libs=/usr/local/lib/

error as follows:

        then mv -f ".deps/myx_grt_lua.Tpo" ".deps/myx_grt_lua.Plo"; else rm -f ".deps/myx_grt_lua.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I../../.. -I../../../library/generic-runtime/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2 -I../../../library/utilities/include -I../../../library/utilities/shared_include -I../../../library/generic-runtime/newt -I/usr/include/mysql -DBIG_JOINS=1 -I/usr/local/include -DDLOAD_JVM -I/usr/local/include -DENABLE_JAVA_MODULES -DENABLE_LUA_MODULES -DLUA_TEXT_DIALOGS -MT myx_grt_lua.lo -MD -MP -MF .deps/myx_grt_lua.Tpo -c myx_grt_lua.c  -fPIC -DPIC -o .libs/myx_grt_lua.o
myx_grt_lua.c:42: error: 'luaopen_loadlib' undeclared here (not in a function)
make[4]: *** [myx_grt_lua.lo] Error 1
make[4]: Leaving directory `/home/ingrid/Downloads/temp/mysql-gui-tools-5.0r6/mysql-gui-common/library/generic-runtime/source'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/ingrid/Downloads/temp/mysql-gui-tools-5.0r6/mysql-gui-common/library/generic-runtime'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/ingrid/Downloads/temp/mysql-gui-tools-5.0r6/mysql-gui-common/library'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/ingrid/Downloads/temp/mysql-gui-tools-5.0r6/mysql-gui-common'
make: *** [all] Error 2

How to repeat:
1. Download mysql gui tools version 5.0r6
2. Download and install lua5.1.1
3. compile mysql-gui-common by passing 

./configure --enable-grt --enable-canvas --with-lua-includes=/usr/local/include --with-lua-libs=/usr/local/lib/
[13 Dec 2006 0:10] MySQL Verification Team
Thank you for the bug report.
[16 Jan 2007 0:30] Narcelio Filho
Here is a small patch to compile MySQL gui-common with Lua 5.1.1. But MySQL Workbench still doesn't runs well, it always crashes with crypt errors messages like:

"PANIC: unprotected error in call to Lua API (no calling environment)"

Maybe those guidelines must be followed to make full migration:

http://lua-users.org/wiki/MigratingToFiveOne

Index: library/generic-runtime/source/myx_grt_lua.c
===================================================================
--- library/generic-runtime/source/myx_grt_lua.c        (revision 1924)
+++ library/generic-runtime/source/myx_grt_lua.c        (working copy)
@@ -39,7 +39,7 @@
         { "string",     luaopen_string },
         { "math",       luaopen_math },
         { "debug",      luaopen_debug },
-        { "loadlib",    luaopen_loadlib },
+        { "package",    luaopen_package },
         { "lxp",        luaopen_lxp },
         { NULL,         NULL }
 };

Index: library/generic-runtime/source/lxp/lxplib.c
===================================================================
--- library/generic-runtime/source/lxp/lxplib.c (revision 1924)
+++ library/generic-runtime/source/lxp/lxplib.c (working copy)
@@ -334,9 +334,7 @@
   lua_pushnil(L);
   while (lua_next(L, 1)) {
     lua_pop(L, 1);  /* remove value */
-    if (lua_type(L, -1) != LUA_TSTRING ||
-        luaL_findstring(lua_tostring(L, -1), validkeys) < 0)
-      luaL_error(L, "invalid key `%s' in callback table", lua_tostring(L, -1));
+    luaL_checkoption(L, -1, NULL, validkeys);
   }
 }