[Freeswitch-users] Lua undefined symbol lua_getfield

KPS Maillinglist ksims.ml at gmail.com
Thu Jan 9 21:46:19 MSK 2014


I'm wriiting because I can't seem to get Lua from within Freeswitch to load
the luasql mysql object. The error on the freeswitch console states that
there's a error loading module luasql.mysql' but when i run a script from
the shell requiring the same file it works just fine. I did due diligience
and researched the issue and seen someone state the proble is due to lua
being compiled from C++ code and the mysql module being compiled from C
source code. Any help will be greatly appreciated because none of my
scripts work because they are all database driven.

FS Cli error:
#########################
2014-01-09 05:36:31.432815 [ERR] mod_lua.cpp:199 error loading module
'luasql.mysql' from file '/usr/local/lib/lua/5.2/luasql/mysql.so':
        /usr/local/lib/lua/5.2/luasql/mysql.so: undefined symbol:
lua_getfield
stack traceback:
        [C]: in ?
        [C]: in function 'require'
        /cdi/fs157/scripts/cdi_scripts/cdi_main_start.lua:2: in main chunk


First few lines of the script in question:
################################
#!/usr/bin/lua
require "luasql.mysql"
-- I also tried to call module like statement below
-- luasql = require "luasql.mysql"
fs_api = freeswitch.API();

dofile "/cdi/cdi_scripts/vars.lua"
dofile "/cdi/cdi_scripts/maininclude.lua"

Shell test script that works
#######################################
#!/usr/bin/lua
luasql = require "luasql.mysql"

env = assert (luasql.mysql())
con = assert
(env:connect("database","username","password","162.21X.XXX.144"))
cur = assert (con:execute"SELECT * FROM xxx_acct_did")
row = cur:fetch ({}, "a")

while true  do end
while row do

print(string.format("DID: %s, Route: %s", row.did, row.route))
  row = cur:fetch (row, "a")
end
cur:close()
con:close()

Output of the script above:
###################################
DID: 18155516741, Route: 8171111741 at 108.111.175.183:5066
DID: 19755514964, Route: 9721111964 at 173.111.252.22:5066
DID: 19155515245, Route: 9171111245 at 150.111.194.215
DID: 19755516483, Route: 9721111483 at 173.111.252.22:5066
DID: 12155516793, Route: 2141111793 at 108.111.175.183:5066
DID: 18755519608, Route: 8771111608 at 173.111.252.22:5066
DID: 18655518946, Route: 8771111608 at 192.111.146.243:5199
DID: 19755517847, Route: 8171111741 at 108.111.175.183:5066
DID: 15155510762, Route: 5101111762 at 173.111.252.22:5066
DID: 14655512043, Route: 4691111043 at 173.111.252.22:5066
DID: 16155519638, Route: 6191111638 at 173.111.252.22:5066
DID: 14655512044, Route: 4691111044 at 173.111.252.22:5066
DID: 18755511623, Route: 8171111741 at 173.111.252.22:5066
DID: 18755511624, Route: 8771111608 at 199.111.249.94:5199
DID: 19725550001, Route: 9721111001 at 173.111.252.22:5066
DID: 16305512270, Route: 8171111741 at 108.111.175.183:5066
DID: 14695512042, Route: 8171111741 at 162.111.160.145:5066

luasql file path:
###############################################

[root at rch-vmli ~]# ls -larth /usr/local/lib/lua/5.2/luasql/mysql.so
-rwxr-xr-x 1 root root 18K Jan  6 10:35
/usr/local/lib/lua/5.2/luasql/mysql.so


FS Info:
######################################
FreeSWITCH Version 1.5.8b+git~20140106T145044Z~8d30da28d7~32bi
Lua version 5.2.2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140109/a0139d99/attachment.html 


Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users mailing list