[Home]

Summary:ASTERISK-17279: [patch] Command 'module load pbx_lua.so' failed
Reporter:Sergik (igels)Labels:
Date Opened:2011-01-25 02:35:12.000-0600Date Closed:2011-03-04 10:00:08.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:PBX/pbx_lua
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) config.log
( 1) pbx_lua_global_symbols1.diff
Description:AstiMile*CLI> module load pbx_lua.so
Unable to load module pbx_lua.so
Command 'module load pbx_lua.so' failed.
[Jan 25 11:23:25] ERROR[18899]: pbx_lua.c:1434 load_or_reload_lua_stuff: Error loading extensions.lua: error loading module 'luasql.mysql' from file '/usr/lib/lua/5.1/luasql/mysql.so':
       /usr/lib/lua/5.1/luasql/mysql.so: undefined symbol: lua_getfield
AstiMile*CLI> /usr/lib/lua/5.1/luasql/mysql.so: undefined symbol: lua_getfield
Comments:By: Walter Doekes (wdoekes) 2011-01-25 02:56:59.000-0600

Looks like a bad install of lua and/or lua-mysql and not an issue with asterisk.

By: Sergik (igels) 2011-01-25 03:02:10.000-0600

if replace pbx_lua.c from asterisk 1.6.x and rebuild, then everything OK.

By: Sergik (igels) 2011-01-25 03:03:12.000-0600

system UBUNTU 10.10, lua installed from repository

By: Walter Doekes (wdoekes) 2011-01-25 03:09:04.000-0600

Try to distill the differences between the two pbx_lua.c's then:

diff -uw asterisk-1.8.2.2/pbx/pbx_lua.c asterisk-1.6.x/pbx/pbx_lua.c

What makes the difference?

By: Sergik (igels) 2011-01-25 03:12:48.000-0600

./pbx_lua.c-old - 1.8.2.2
./pbx_lua.c - 1.6.2.16.1

--- ./pbx_lua.c-old     2010-07-20 23:35:02.000000000 +0400
+++ ./pbx_lua.c 2011-01-25 11:29:50.597843774 +0300
@@ -30,7 +30,7 @@

#include "asterisk.h"

-ASTERISK_FILE_VERSION(__FILE__, "$Revision: 278132 $")
+ASTERISK_FILE_VERSION(__FILE__, "$Revision: 265748 $")

#include "asterisk/logger.h"
#include "asterisk/channel.h"
@@ -84,7 +84,7 @@
static void lua_create_autoservice_functions(lua_State *L);
static void lua_create_hangup_function(lua_State *L);

-static void lua_state_destroy(void *data);
+void lua_state_destroy(void *data);
static lua_State *lua_get_state(struct ast_channel *chan);

static int exists(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data);
@@ -93,8 +93,8 @@
static int exec(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data);

AST_MUTEX_DEFINE_STATIC(config_file_lock);
-static char *config_file_data = NULL;
-static long config_file_size = 0;
+char *config_file_data = NULL;
+long config_file_size = 0;

static struct ast_context *local_contexts = NULL;
static struct ast_hashtab *local_table = NULL;
@@ -108,7 +108,7 @@
/*!
 * \brief The destructor for lua_datastore
 */
-static void lua_state_destroy(void *data)
+void lua_state_destroy(void *data)
{
       if (data)
               lua_close(data);
@@ -1467,7 +1467,7 @@
       return AST_MODULE_LOAD_SUCCESS;
}

-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Lua PBX Switch",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Lua PBX Switch",
               .load = load_module,
               .unload = unload_module,
               .reload = reload,



By: Walter Doekes (wdoekes) 2011-01-25 04:05:40.000-0600

And if you take the original and only this replacement?

AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Lua PBX Switch",

By: Sergik (igels) 2011-01-26 07:44:19.000-0600

Thats work! Thank's!

By: Sean Bright (seanbright) 2011-01-26 09:52:21.000-0600

I'm not able to replicate this issue on Ubuntu 10.04.1 with the latest 1.8 or trunk.

By: Leif Madsen (lmadsen) 2011-02-07 14:22:48.000-0600

I'm closing this per seanbright's comments.

By: Sergik (igels) 2011-02-11 03:45:36.000-0600

Ubuntu 10.04.1 LTS
Asterisk 1.8.2.3
Same problem, same way to fix it.

By: Sean Bright (seanbright) 2011-02-11 13:27:23.000-0600

Can you try to replicate the problem with the latest 1.8 from Subversion?

 $ svn co http://svn.digium.com/svn/asterisk/branches/1.8 asterisk-1.8
 $ cd asterisk-1.8

Then configure and build as usual  If it fails - upload your config.log file.  This will help to isolate what exactly is wrong with your environment.

By: Sergik (igels) 2011-02-11 15:41:56.000-0600

I have updated my system to Ubuntu 10.04.2 LTS
and download Asterisk SVN-branch-1.8-r3075367.
The problem has remained.

By: Matthew Nicholson (mnicholson) 2011-02-25 13:05:22.000-0600

I have attached a patch that causes the necessary symbols to be properly exported.

By: Digium Subversion (svnbot) 2011-03-04 09:59:26.000-0600

Repository: asterisk
Revision: 309448

U   branches/1.8/pbx/pbx_lua.c

------------------------------------------------------------------------
r309448 | mnicholson | 2011-03-04 09:59:26 -0600 (Fri, 04 Mar 2011) | 8 lines

Export global symbols from pbx_lua to allow modules to be loaded.  Fixes a regression introduced in r278132.

(closes issue ASTERISK-17279)
Reported by: Igels
Patches:
     pbx_lua_global_symbols1.diff uploaded by mnicholson (license 96)
Tested by: Igels

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=309448

By: Digium Subversion (svnbot) 2011-03-04 10:00:07.000-0600

Repository: asterisk
Revision: 309449

_U  trunk/
U   trunk/pbx/pbx_lua.c

------------------------------------------------------------------------
r309449 | mnicholson | 2011-03-04 10:00:06 -0600 (Fri, 04 Mar 2011) | 15 lines

Merged revisions 309448 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
 r309448 | mnicholson | 2011-03-04 09:59:25 -0600 (Fri, 04 Mar 2011) | 8 lines
 
 Export global symbols from pbx_lua to allow modules to be loaded.  Fixes a regression introduced in r278132.
 
 (closes issue ASTERISK-17279)
 Reported by: Igels
 Patches:
       pbx_lua_global_symbols1.diff uploaded by mnicholson (license 96)
 Tested by: Igels
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=309449