undefinied symbol with Lua 5.1 and luasql lib

Added by Spyhawk over 5 years ago

I’m trying to use the luasql-sqlite3 library with ET:L compiled with Lua 5.1 support (system lib). When launching the server, the script is loaded but the call to the luasql-sqlite plugin fails. The luasql-sqlite is installed with luarocks.

In the script, sqlite is called without success with

luasql = require("luasql.sqlite3")

Here’s the error I get:

Lua 5.1 API: Loading script.lua
Lua API: et_InitGame error running lua script: error loading module 'luasql.sqlite3’ from file '<path>/lualibs/luasql/sqlite3.so’:
<path>/lualibs/luasql/sqlite3.so: undefined symbol: lua_settop

I found a possible explanation here. The issue described is likely the same I’m facing.

You need to tell the linker to export the Lua symbols so they are
visible to a dynamic object that is loaded at runtime. With GCC it’s
typically the following you need to add to your link command: -Wl,-E
(see also the 'ld’ man page).

I have no idea how to do that - maybe knowledgeable people could give me a hint?


Replies (21)

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by Spyhawk over 5 years ago

Note: I can successfully access to luasql-sqlite3 from the lua 5.1 console (open/create/close a db). Is that a bug in the current Legacy Lua implementation?

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by Spyhawk over 5 years ago

I got my answer on IRC. Lua-SQL is currently not implemented in Legacy mod
See also this post.

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by eLBati almost 3 years ago

Hi,
I’m still getting this error, but now ET Legacy should support it.
Indeed I’m trying to run
https://github.com/etlegacy/etlegacy-lua_scripts/blob/master/xpsave/xpsave.lua
but getting

Lua API: G_LuaStartVM error running lua script: error loading module 'luasql.sqlite3’ from file './legacy/lualibs/luasql/sqlite3.so’:
./legacy/lualibs/luasql/sqlite3.so: undefined symbol: lua_settop

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by Spyhawk almost 3 years ago

What’s your system? Did you compile luasql yourself?

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by eLBati almost 3 years ago

Ubuntu server 14.04 (64bit).
I’m running etlegacy-v2.74-i386 (because download page http://www.etlegacy.com/download says '64 bit Linux is NOT 2.60b compatible!') and installed 'sqlite3.so’ with package 'lua-sql-sqlite3:i386’

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by Spyhawk almost 3 years ago

If you’re running a server, you can still use the 64bit version. Regular 32 bit clients should be be able to connect to the server, as Legacy mod is provided for Linux 32, 64 bit, windows and Mac platforms.
It’s only not recommended to use 64 bit as a client, as you’ll only be able to connect to servers that provide mods in 64 bit (only Legacy mod as of yet).

This will make your server install a bit easier, although I am not sure if that would fix that Lua issue.

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by Spyhawk almost 3 years ago

Note also the latest stable version of luasql doesn’t seem compatible with Lua 5.3, but they fixed it in the current master branch.

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by eLBati almost 3 years ago

Ok, I tried using 'etlegacy-v2.74-x86_64’
With 'sqlite3.so’ for lua 5.1 I get

undefined symbol: lua_settop

With 'sqlite3.so’ for lua 5.2 I get

undefined symbol: lua_settop

With 'sqlite3.so’ installed with luarocks I get

undefined symbol: lua_checkstack

With 'sqlite3.so’ compiled with https://github.com/keplerproject/luasql and lua 5.3.2 (http://www.lua.org/ftp/) (luasql compiled with 'make sqlite3’ after setting 'LUA_SYS_VER ?= 5.3’ in config file) I get

undefined symbol: lua_settop

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by Spyhawk almost 3 years ago

Thanks for testing.

Using nm on Legacy mod qagame file (official 2.74 version), we see symbols are available.

0000000000123670 t luaB_assert
0000000000123910 t luaB_auxwrap
0000000000123b80 t luaB_cocreate
00000000001235a0 t luaB_collectgarbage
0000000000123ae0 t luaB_coresume
0000000000123b60 t luaB_corunning
0000000000123a10 t luaB_costatus
0000000000123be0 t luaB_cowrap
0000000000123520 t luaB_dofile
00000000001234b0 t luaB_error
0000000000123460 t luaB_getmetatable
0000000000122d30 t luaB_ipairs
0000000000123190 t luaB_load
0000000000123370 t luaB_loadfile
00000000001230d0 t luaB_next
00000000001236f0 t luaB_pairs
00000000001228c0 t luaB_pcall
0000000000122f80 t luaB_print
0000000000122f40 t luaB_rawequal
0000000000122ea0 t luaB_rawget
0000000000122ef0 t luaB_rawlen
0000000000122e50 t luaB_rawset
0000000000122990 t luaB_select
0000000000122da0 t luaB_setmetatable
0000000000122ab0 t luaB_tonumber
0000000000122920 t luaB_tostring
0000000000122950 t luaB_type
0000000000122830 t luaB_xpcall
00000000001237e0 t luaB_yield
00000000001237c0 t luaB_yieldable
0000000000110f20 t luaC_barrier_
0000000000110d00 t luaC_barrierback_
0000000000111530 t luaC_checkfinalizer
0000000000110d20 t luaC_fix
0000000000111f20 t luaC_freeallobjects
0000000000112890 t luaC_fullgc
0000000000111250 t luaC_newobj
0000000000112850 t luaC_runtilstate
0000000000112710 t luaC_step
0000000000110ef0 t luaC_upvalbarrier_
0000000000111220 t luaC_upvdeccount
00000000001102b0 t luaD_call
000000000010fa60 t luaD_growstack
000000000010fad0 t luaD_hook
000000000010f460 t luaD_pcall
000000000010fbd0 t luaD_poscall
000000000010fdb0 t luaD_precall
000000000010f520 t luaD_protectedparser
000000000010f3d0 t luaD_rawrunprotected
000000000010f150 t luaD_reallocstack
000000000010f320 t luaD_shrinkstack
000000000010f7a0 t luaD_throw
0000000000117140 t luaE_extendCI
0000000000116fc0 t luaE_freeCI
00000000001170f0 t luaE_freethread
0000000000116ec0 t luaE_setdebt
0000000000116f60 t luaE_shrinkCI
0000000000110c80 t luaF_close
0000000000110a50 t luaF_findupval
00000000001109a0 t luaF_freeproto
0000000000110950 t luaF_getlocalname
0000000000110b00 t luaF_initupvals
0000000000110c60 t luaF_newCclosure
0000000000110c10 t luaF_newLclosure
0000000000110b70 t luaF_newproto
000000000010e200 t luaG_addinfo
000000000010ebc0 t luaG_concaterror
000000000010e190 t luaG_errormsg
000000000010ebe0 t luaG_opinterror
000000000010e370 t luaG_ordererror
000000000010e290 t luaG_runerror
000000000010eb00 t luaG_tointerror
000000000010e020 t luaG_traceexec
000000000010eb70 t luaG_typeerror
0000000000118290 t luaH_free
0000000000117fa0 t luaH_get
0000000000117c20 t luaH_getint
0000000000117ce0 t luaH_getn
0000000000117c90 t luaH_getstr
0000000000118ab0 t luaH_new
0000000000118590 t luaH_newkey
00000000001180d0 t luaH_next
00000000001183f0 t luaH_resize
0000000000118a90 t luaH_resizearray
0000000000118a20 t luaH_set
0000000000118990 t luaH_setint
000000000011f510 t luaK_checkstack
000000000011f610 t luaK_code
000000000011f7f0 t luaK_codeABC
000000000011f6f0 t luaK_codeABx
000000000011f770 t luaK_codek
000000000011f470 t luaK_concat
000000000011f830 t luaK_dischargevars
00000000001202f0 t luaK_exp2RK
0000000000120240 t luaK_exp2anyreg
00000000001202d0 t luaK_exp2anyregup
00000000001201d0 t luaK_exp2nextreg
00000000001202b0 t luaK_exp2val
000000000011f2f0 t luaK_fixline
000000000011f220 t luaK_getlabel
000000000011fea0 t luaK_goiffalse
000000000011ff20 t luaK_goiftrue
0000000000120d90 t luaK_indexed
0000000000120d20 t luaK_infix
000000000011fc00 t luaK_intK
000000000011f710 t luaK_jump
000000000011f910 t luaK_nil
000000000011f230 t luaK_patchclose
000000000011f4f0 t luaK_patchlist
000000000011f4d0 t luaK_patchtohere
0000000000120b50 t luaK_posfix
00000000001207c0 t luaK_prefix
000000000011f550 t luaK_reserveregs
000000000011f8f0 t luaK_ret
0000000000120dc0 t luaK_self
000000000011f9d0 t luaK_setlist
000000000011f290 t luaK_setoneret
000000000011f580 t luaK_setreturns
0000000000120ea0 t luaK_storevar
0000000000120fe0 t luaK_stringK
000000000011e330 T luaL_addlstring
000000000011e420 T luaL_addstring
000000000011e380 T luaL_addvalue
000000000011e850 T luaL_argerror
000000000011d090 T luaL_buffinit
000000000011e2f0 T luaL_buffinitsize
000000000011d450 T luaL_callmeta
000000000011edc0 T luaL_checkany
000000000011ecd0 T luaL_checkinteger
000000000011eb20 T luaL_checklstring
000000000011ea70 T luaL_checknumber
000000000011ee10 T luaL_checkoption
000000000011e510 T luaL_checkstack
000000000011ec10 T luaL_checktype
000000000011ec70 T luaL_checkudata
000000000011e0c0 T luaL_checkversion_
000000000011dfd0 T luaL_error
000000000011de90 T luaL_execresult
000000000011ddd0 T luaL_fileresult
000000000011d3c0 T luaL_getmetafield
000000000011d170 T luaL_getsubtable
000000000011e460 T luaL_gsub
000000000011e190 T luaL_len
000000000011d660 T luaL_loadbufferx
000000000011d810 T luaL_loadfilex
000000000011d690 T luaL_loadstring
000000000011d330 T luaL_newmetatable
000000000011d0d0 T luaL_newstate
000000000011f1c0 T luaL_openlibs
000000000011ed60 T luaL_optinteger
000000000011eb80 T luaL_optlstring
000000000011eac0 T luaL_optnumber
000000000011e200 T luaL_prepbuffsize
000000000011dc80 T luaL_pushresult
000000000011dcf0 T luaL_pushresultsize
000000000011db90 T luaL_ref
000000000011d200 T luaL_requiref
000000000011e590 T luaL_setfuncs
000000000011ddb0 T luaL_setmetatable
000000000011dd00 T luaL_testudata
000000000011d4c0 T luaL_tolstring
000000000011eeb0 T luaL_traceback
000000000011db00 T luaL_unref
000000000011df50 T luaL_where
0000000000112a00 t luaM_growaux_
0000000000112930 t luaM_realloc_
00000000001129e0 t luaM_toobig
0000000000113700 t luaO_arith
0000000000112af0 t luaO_ceillog2
0000000000112bb0 t luaO_chunkid
0000000000112ad0 t luaO_fb2int
0000000000112b20 t luaO_hexavalue
0000000000112a80 t luaO_int2fb
00000000001519b0 r luaO_nilobject_
0000000000113210 t luaO_pushfstring
0000000000112e00 t luaO_pushvfstring
00000000001132a0 t luaO_str2num
0000000000112d30 t luaO_tostring
0000000000112b50 t luaO_utf8esc
0000000000151c00 r luaP_opmodes
00000000003737e0 d luaP_opnames
00000000001176d0 t luaS_clearcache
00000000001177a0 t luaS_eqlngstr
0000000000117670 t luaS_hash
0000000000117bb0 t luaS_init
0000000000117b10 t luaS_new
0000000000117960 t luaS_newlstr
0000000000117750 t luaS_newudata
0000000000117710 t luaS_remove
0000000000117850 t luaS_resize
0000000000118b10 t luaT_callTM
0000000000118c60 t luaT_callbinTM
0000000000118d00 t luaT_callorderTM
00000000003739c0 d luaT_eventname.3014
0000000000118e60 t luaT_gettm
0000000000118bf0 t luaT_gettmbyobj
0000000000118ec0 t luaT_init
0000000000118d50 t luaT_trybinTM
0000000000373960 d luaT_typenames_
0000000000110840 t luaU_dump
00000000001195b0 t luaU_undump
00000000001199f0 t luaV_concat
0000000000119850 t luaV_div
000000000011a7b0 t luaV_equalobj
000000000011aaf0 t luaV_execute
0000000000119d30 t luaV_finishOp
000000000011a3c0 t luaV_gettable
0000000000119f90 t luaV_lessequal
000000000011a1d0 t luaV_lessthan
00000000001197f0 t luaV_mod
00000000001198b0 t luaV_objlen
000000000011a510 t luaV_settable
00000000001197b0 t luaV_shiftl
000000000011a6b0 t luaV_tointeger
000000000011aa40 t luaV_tonumber_
0000000000122680 t luaX_init
0000000000122620 t luaX_lookahead
0000000000121790 t luaX_newstring
0000000000122640 t luaX_next
0000000000121700 t luaX_setinput
0000000000121360 t luaX_syntaxerror
0000000000121060 t luaX_token2str
0000000000373a80 d luaX_tokens
0000000000116c20 t luaY_parser
000000000011cf10 t luaZ_fill
000000000011cf70 t luaZ_init
000000000011cf90 t luaZ_openspace
000000000011d000 t luaZ_read
000000000010c080 T lua_absindex
0000000000f13480 b lua_allowedModules
000000000010de80 T lua_arith
000000000010c040 T lua_atpanic
000000000010d090 T lua_callk
000000000010ded0 T lua_checkstack
00000000001170e0 T lua_close
000000000010dd80 T lua_compare
000000000010caf0 T lua_concat
000000000010c9e0 T lua_copy
000000000010d620 T lua_createtable
000000000010cdd0 T lua_dump
000000000010cc30 T lua_error
000000000010cc40 T lua_gc
000000000010c600 T lua_getallocf
000000000010d7a0 T lua_getfield
000000000010d860 T lua_getglobal
000000000010dfb0 T lua_gethook
000000000010dfd0 T lua_gethookcount
000000000010dfc0 T lua_gethookmask
000000000010d750 T lua_geti
000000000010ec40 T lua_getinfo
000000000010e580 T lua_getlocal
000000000010c550 T lua_getmetatable
000000000010dfe0 T lua_getstack
000000000010d830 T lua_gettable
000000000010c0b0 T lua_gettop
000000000010c630 T lua_getupvalue
000000000010c5c0 T lua_getuservalue
0000000000151060 R lua_ident
000000000010c310 T lua_iscfunction
000000000010c330 T lua_isinteger
000000000010dcb0 T lua_isnumber
000000000010c340 T lua_isstring
000000000010c360 T lua_isuserdata
000000000010f140 T lua_isyieldable
000000000010cad0 T lua_len
000000000010ce00 T lua_load
00000000030bee80 b lua_modules
0000000000117170 T lua_newstate
0000000000117550 T lua_newthread
000000000010ca80 T lua_newuserdata
000000000010cbf0 T lua_next
000000000010cf40 T lua_pcallk
000000000010c4e0 T lua_pushboolean
000000000010d900 T lua_pushcclosure
000000000010da00 T lua_pushfstring
000000000010c4c0 T lua_pushinteger
000000000010c500 T lua_pushlightuserdata
000000000010cb90 T lua_pushlstring
000000000010c480 T lua_pushnil
000000000010c4a0 T lua_pushnumber
000000000010d5a0 T lua_pushstring
000000000010c520 T lua_pushthread
000000000010c280 T lua_pushvalue
000000000010d9c0 T lua_pushvfstring
000000000010dd00 T lua_rawequal
000000000010d710 T lua_rawget
000000000010ced0 T lua_rawgeti
000000000010d6b0 T lua_rawgetp
000000000010dac0 T lua_rawlen
000000000010d2d0 T lua_rawset
000000000010d360 T lua_rawseti
000000000010d230 T lua_rawsetp
000000000010f630 T lua_resume
000000000010c140 T lua_rotate
000000000010c620 T lua_setallocf
000000000010d480 T lua_setfield
000000000010d510 T lua_setglobal
000000000010df70 T lua_sethook
000000000010d3f0 T lua_seti
000000000010e4e0 T lua_setlocal
000000000010d110 T lua_setmetatable
000000000010d450 T lua_settable
000000000010c0d0 T lua_settop
000000000010c810 T lua_setupvalue
000000000010c980 T lua_setuservalue
000000000010c5f0 T lua_status
000000000010dce0 T lua_stringtonumber
000000000010c380 T lua_toboolean
000000000010c3b0 T lua_tocfunction
000000000010dc10 T lua_tointegerx
000000000010db40 T lua_tolstring
000000000010dc60 T lua_tonumberx
000000000010c430 T lua_topointer
000000000010c410 T lua_tothread
000000000010c3e0 T lua_touserdata
000000000010c2c0 T lua_type
000000000010c2f0 T lua_typename
000000000010c700 T lua_upvalueid
000000000010c740 T lua_upvaluejoin
000000000010c060 T lua_version
000000000010bfe0 T lua_xmove
000000000010f990 T lua_yieldk
0000000000152b40 r luai_ctype_
00000000001226f0 T luaopen_base
0000000000123780 T luaopen_coroutine
0000000000123c10 T luaopen_debug
00000000001260e0 T luaopen_io
0000000000126380 T luaopen_math
0000000000126ed0 T luaopen_os
000000000012cd40 T luaopen_package
000000000012ac10 T luaopen_string
000000000012ad10 T luaopen_table
000000000012bb50 T luaopen_utf8

My system sqlite3.so (from luasql) doesn’t include symbols, but the one I compile myself does. Maybe try to double check your sqlite3.so file? See if the version of your system and the one you compiled yourself provide symbols, using nm.

note: if nm returns "U", this means "undefined".

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by eLBati almost 3 years ago

Thanks for your support Spyhawk.

See my qagame symbols;

$ nm legacy/qagame.mp.x86_64.so
[...]
000000000010c080 T lua_absindex
0000000000f13480 b lua_allowedModules
000000000010de80 T lua_arith
000000000010c040 T lua_atpanic
0000000000123670 t luaB_assert
0000000000123910 t luaB_auxwrap
0000000000123b80 t luaB_cocreate
00000000001235a0 t luaB_collectgarbage
0000000000123ae0 t luaB_coresume
0000000000123b60 t luaB_corunning
0000000000123a10 t luaB_costatus
0000000000123be0 t luaB_cowrap
0000000000123520 t luaB_dofile
00000000001234b0 t luaB_error
0000000000123460 t luaB_getmetatable
0000000000122d30 t luaB_ipairs
0000000000123190 t luaB_load
0000000000123370 t luaB_loadfile
00000000001230d0 t luaB_next
00000000001236f0 t luaB_pairs
00000000001228c0 t luaB_pcall
0000000000122f80 t luaB_print
0000000000122f40 t luaB_rawequal
0000000000122ea0 t luaB_rawget
0000000000122ef0 t luaB_rawlen
0000000000122e50 t luaB_rawset
0000000000122990 t luaB_select
0000000000122da0 t luaB_setmetatable
0000000000122ab0 t luaB_tonumber
0000000000122920 t luaB_tostring
0000000000122950 t luaB_type
0000000000122830 t luaB_xpcall
00000000001237e0 t luaB_yield
00000000001237c0 t luaB_yieldable
000000000010d090 T lua_callk
0000000000110f20 t luaC_barrier_
0000000000110d00 t luaC_barrierback_
0000000000111530 t luaC_checkfinalizer
0000000000110d20 t luaC_fix
0000000000111f20 t luaC_freeallobjects
0000000000112890 t luaC_fullgc
000000000010ded0 T lua_checkstack
00000000001170e0 T lua_close
0000000000111250 t luaC_newobj
000000000010dd80 T lua_compare
000000000010caf0 T lua_concat
000000000010c9e0 T lua_copy
000000000010d620 T lua_createtable
0000000000112850 t luaC_runtilstate
0000000000112710 t luaC_step
0000000000110ef0 t luaC_upvalbarrier_
0000000000111220 t luaC_upvdeccount
00000000001102b0 t luaD_call
000000000010fa60 t luaD_growstack
000000000010fad0 t luaD_hook
000000000010f460 t luaD_pcall
000000000010fbd0 t luaD_poscall
000000000010fdb0 t luaD_precall
000000000010f520 t luaD_protectedparser
000000000010f3d0 t luaD_rawrunprotected
000000000010f150 t luaD_reallocstack
000000000010f320 t luaD_shrinkstack
000000000010f7a0 t luaD_throw
000000000010cdd0 T lua_dump
0000000000117140 t luaE_extendCI
0000000000116fc0 t luaE_freeCI
00000000001170f0 t luaE_freethread
000000000010cc30 T lua_error
0000000000116ec0 t luaE_setdebt
0000000000116f60 t luaE_shrinkCI
0000000000110c80 t luaF_close
0000000000110a50 t luaF_findupval
00000000001109a0 t luaF_freeproto
0000000000110950 t luaF_getlocalname
0000000000110b00 t luaF_initupvals
0000000000110c60 t luaF_newCclosure
0000000000110c10 t luaF_newLclosure
0000000000110b70 t luaF_newproto
000000000010e200 t luaG_addinfo
000000000010cc40 T lua_gc
000000000010ebc0 t luaG_concaterror
000000000010e190 t luaG_errormsg
000000000010c600 T lua_getallocf
000000000010d7a0 T lua_getfield
000000000010d860 T lua_getglobal
000000000010dfb0 T lua_gethook
000000000010dfd0 T lua_gethookcount
000000000010dfc0 T lua_gethookmask
000000000010d750 T lua_geti
000000000010ec40 T lua_getinfo
000000000010e580 T lua_getlocal
000000000010c550 T lua_getmetatable
000000000010dfe0 T lua_getstack
000000000010d830 T lua_gettable
000000000010c0b0 T lua_gettop
000000000010c630 T lua_getupvalue
000000000010c5c0 T lua_getuservalue
000000000010ebe0 t luaG_opinterror
000000000010e370 t luaG_ordererror
000000000010e290 t luaG_runerror
000000000010eb00 t luaG_tointerror
000000000010e020 t luaG_traceexec
000000000010eb70 t luaG_typeerror
0000000000118290 t luaH_free
0000000000117fa0 t luaH_get
0000000000117c20 t luaH_getint
0000000000117ce0 t luaH_getn
0000000000117c90 t luaH_getstr
0000000000118ab0 t luaH_new
0000000000118590 t luaH_newkey
00000000001180d0 t luaH_next
00000000001183f0 t luaH_resize
0000000000118a90 t luaH_resizearray
0000000000118a20 t luaH_set
0000000000118990 t luaH_setint
0000000000152b40 r luai_ctype_
0000000000151060 R lua_ident
000000000010c310 T lua_iscfunction
000000000010c330 T lua_isinteger
000000000010dcb0 T lua_isnumber
000000000010c340 T lua_isstring
000000000010c360 T lua_isuserdata
000000000010f140 T lua_isyieldable
000000000011f510 t luaK_checkstack
000000000011f610 t luaK_code
000000000011f7f0 t luaK_codeABC
000000000011f6f0 t luaK_codeABx
000000000011f770 t luaK_codek
000000000011f470 t luaK_concat
000000000011f830 t luaK_dischargevars
0000000000120240 t luaK_exp2anyreg
00000000001202d0 t luaK_exp2anyregup
00000000001201d0 t luaK_exp2nextreg
00000000001202f0 t luaK_exp2RK
00000000001202b0 t luaK_exp2val
000000000011f2f0 t luaK_fixline
000000000011f220 t luaK_getlabel
000000000011fea0 t luaK_goiffalse
000000000011ff20 t luaK_goiftrue
0000000000120d90 t luaK_indexed
0000000000120d20 t luaK_infix
000000000011fc00 t luaK_intK
000000000011f710 t luaK_jump
000000000011f910 t luaK_nil
000000000011f230 t luaK_patchclose
000000000011f4f0 t luaK_patchlist
000000000011f4d0 t luaK_patchtohere
0000000000120b50 t luaK_posfix
00000000001207c0 t luaK_prefix
000000000011f550 t luaK_reserveregs
000000000011f8f0 t luaK_ret
0000000000120dc0 t luaK_self
000000000011f9d0 t luaK_setlist
000000000011f290 t luaK_setoneret
000000000011f580 t luaK_setreturns
0000000000120ea0 t luaK_storevar
0000000000120fe0 t luaK_stringK
000000000011e330 T luaL_addlstring
000000000011e420 T luaL_addstring
000000000011e380 T luaL_addvalue
000000000011e850 T luaL_argerror
000000000011d090 T luaL_buffinit
000000000011e2f0 T luaL_buffinitsize
000000000011d450 T luaL_callmeta
000000000011edc0 T luaL_checkany
000000000011ecd0 T luaL_checkinteger
000000000011eb20 T luaL_checklstring
000000000011ea70 T luaL_checknumber
000000000011ee10 T luaL_checkoption
000000000011e510 T luaL_checkstack
000000000011ec10 T luaL_checktype
000000000011ec70 T luaL_checkudata
000000000011e0c0 T luaL_checkversion_
000000000010cad0 T lua_len
000000000011dfd0 T luaL_error
000000000011de90 T luaL_execresult
000000000011ddd0 T luaL_fileresult
000000000011d3c0 T luaL_getmetafield
000000000011d170 T luaL_getsubtable
000000000011e460 T luaL_gsub
000000000011e190 T luaL_len
000000000011d660 T luaL_loadbufferx
000000000011d810 T luaL_loadfilex
000000000011d690 T luaL_loadstring
000000000011d330 T luaL_newmetatable
000000000011d0d0 T luaL_newstate
000000000010ce00 T lua_load
000000000011f1c0 T luaL_openlibs
000000000011ed60 T luaL_optinteger
000000000011eb80 T luaL_optlstring
000000000011eac0 T luaL_optnumber
000000000011e200 T luaL_prepbuffsize
000000000011dc80 T luaL_pushresult
000000000011dcf0 T luaL_pushresultsize
000000000011db90 T luaL_ref
000000000011d200 T luaL_requiref
000000000011e590 T luaL_setfuncs
000000000011ddb0 T luaL_setmetatable
000000000011dd00 T luaL_testudata
000000000011d4c0 T luaL_tolstring
000000000011eeb0 T luaL_traceback
000000000011db00 T luaL_unref
000000000011df50 T luaL_where
0000000000112a00 t luaM_growaux_
00000000030bee80 b lua_modules
0000000000112930 t luaM_realloc_
00000000001129e0 t luaM_toobig
0000000000117170 T lua_newstate
0000000000117550 T lua_newthread
000000000010ca80 T lua_newuserdata
000000000010cbf0 T lua_next
0000000000113700 t luaO_arith
0000000000112af0 t luaO_ceillog2
0000000000112bb0 t luaO_chunkid
0000000000112ad0 t luaO_fb2int
0000000000112b20 t luaO_hexavalue
0000000000112a80 t luaO_int2fb
00000000001519b0 r luaO_nilobject_
00000000001226f0 T luaopen_base
0000000000123780 T luaopen_coroutine
0000000000123c10 T luaopen_debug
00000000001260e0 T luaopen_io
0000000000126380 T luaopen_math
0000000000126ed0 T luaopen_os
000000000012cd40 T luaopen_package
000000000012ac10 T luaopen_string
000000000012ad10 T luaopen_table
000000000012bb50 T luaopen_utf8
0000000000113210 t luaO_pushfstring
0000000000112e00 t luaO_pushvfstring
00000000001132a0 t luaO_str2num
0000000000112d30 t luaO_tostring
0000000000112b50 t luaO_utf8esc
000000000010cf40 T lua_pcallk
0000000000151c00 r luaP_opmodes
00000000003737e0 d luaP_opnames
000000000010c4e0 T lua_pushboolean
000000000010d900 T lua_pushcclosure
000000000010da00 T lua_pushfstring
000000000010c4c0 T lua_pushinteger
000000000010c500 T lua_pushlightuserdata
000000000010cb90 T lua_pushlstring
000000000010c480 T lua_pushnil
000000000010c4a0 T lua_pushnumber
000000000010d5a0 T lua_pushstring
000000000010c520 T lua_pushthread
000000000010c280 T lua_pushvalue
000000000010d9c0 T lua_pushvfstring
000000000010dd00 T lua_rawequal
000000000010d710 T lua_rawget
000000000010ced0 T lua_rawgeti
000000000010d6b0 T lua_rawgetp
000000000010dac0 T lua_rawlen
000000000010d2d0 T lua_rawset
000000000010d360 T lua_rawseti
000000000010d230 T lua_rawsetp
000000000010f630 T lua_resume
000000000010c140 T lua_rotate
00000000001176d0 t luaS_clearcache
00000000001177a0 t luaS_eqlngstr
000000000010c620 T lua_setallocf
000000000010d480 T lua_setfield
000000000010d510 T lua_setglobal
000000000010df70 T lua_sethook
000000000010d3f0 T lua_seti
000000000010e4e0 T lua_setlocal
000000000010d110 T lua_setmetatable
000000000010d450 T lua_settable
000000000010c0d0 T lua_settop
[...]

lua_settop and lua_checkstack are both available.

When I save xpsave.lua to legacy dir and set

set lua_modules "xpsave.lua"
I get
Lua 5.3 API: Loading xpsave.lua
Lua API: G_LuaStartVM error running lua script: [string "xpsave.lua"]:16: module 'luasql.sqlite3' not found:
    no field package.preload['luasql.sqlite3']
    no file './legacy/luasql/sqlite3.lua'
    no file './legacy/lualibs/luasql/sqlite3.lua'
    no file '/home/elbati/.etlegacy/legacy/luasql/sqlite3.lua'
    no file '/home/elbati/.etlegacy/legacy/lualibs/luasql/sqlite3.lua'
    no file './legacy/lualibs/luasql/sqlite3.so'
    no file '/home/elbati/.etlegacy/legacy/lualibs/luasql/sqlite3.so'
    no file './legacy/lualibs/luasql.so'
    no file '/home/elbati/.etlegacy/legacy/lualibs/luasql.so'

Then, after copying sqlite3.so, installed with luarocks, to
./legacy/lualibs/luasql/sqlite3.so
I get
Lua 5.3 API: Loading xpsave.lua
Lua API: G_LuaStartVM error running lua script: error loading module 'luasql.sqlite3' from file './legacy/lualibs/luasql/sqlite3.so':
    ./legacy/lualibs/luasql/sqlite3.so: undefined symbol: lua_settop

Maybe I made something wrong trying to enable xpsave.lua?

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by Spyhawk almost 3 years ago

Does your sqlite3.so provided by luarocks have symbols too?

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by eLBati almost 3 years ago

Spyhawk wrote:

Does your sqlite3.so provided by luarocks have symbols too?

It doesn’t. Indeed I get

undefined symbol: lua_settop

See nm against sqlite3.so provided by luarocks:

$ nm /usr/local/lib/lua/5.1/luasql/sqlite3.so
00000000002042f0 B __bss_start
00000000002042f0 b completed.6973
0000000000002ad0 t conn_close
0000000000002640 t conn_commit
00000000000023e0 t conn_escape
0000000000002cc0 t conn_execute
0000000000002a50 t conn_gc
0000000000002570 t conn_getlastautoid
00000000000025a0 t conn_rollback
00000000000026e0 t conn_setautocommit
0000000000002110 t create_environment
0000000000002350 t cur_close
0000000000002820 t cur_fetch
00000000000021f0 t cur_gc
00000000000024e0 t cur_getcolnames
00000000000024c0 t cur_getcoltypes
0000000000002180 t cur_nullify
                 w __cxa_finalize@@GLIBC_2.2.5
0000000000001c60 t deregister_tm_clones
0000000000001cd0 t __do_global_dtors_aux
0000000000203df8 t __do_global_dtors_aux_fini_array_entry
0000000000204240 d __dso_handle
0000000000203e08 d _DYNAMIC
00000000002042f0 D _edata
00000000002042f8 B _end
00000000000029c0 t env_close
0000000000002b60 t env_connect
0000000000002150 t env_gc
00000000000027b0 t finalize
00000000000030e4 T _fini
0000000000001d10 t frame_dummy
0000000000203df0 t __frame_dummy_init_array_entry
0000000000003b60 r __FRAME_END__
0000000000002500 t getconnection
0000000000002450 t getcursor
0000000000204000 d _GLOBAL_OFFSET_TABLE_
                 w __gmon_start__
00000000000017f8 T _init
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
0000000000203e00 d __JCR_END__
0000000000203e00 d __JCR_LIST__
                 w _Jv_RegisterClasses
                 U lua_concat
                 U lua_createtable
                 U lua_error
                 U lua_getfield
                 U lua_isnumber
                 U luaL_argerror
                 U luaL_checklstring
                 U luaL_checkstack
                 U luaL_checkudata
                 U luaL_error
                 U luaL_newmetatable
                 U luaL_optlstring
                 U luaL_ref
0000000000001eb0 T luaL_setfuncs
                 U luaL_unref
                 U lua_newuserdata
0000000000002f30 T luaopen_luasql_sqlite3
                 U lua_pushboolean
                 U lua_pushcclosure
                 U lua_pushfstring
                 U lua_pushinteger
                 U lua_pushlstring
                 U lua_pushnil
                 U lua_pushnumber
                 U lua_pushstring
                 U lua_pushvalue
                 U lua_rawgeti
                 U lua_rawset
                 U lua_rawseti
                 U lua_setmetatable
                 U lua_settable
                 U lua_settop
0000000000001f60 T luasql_createmeta
0000000000001e00 T luasql_faildirect
0000000000001e50 T luasql_failmsg
0000000000002060 T luasql_set_info
0000000000002040 T luasql_setmeta
0000000000001d50 t luasql_tostring
                 U lua_toboolean
                 U lua_tolstring
                 U lua_tonumber
                 U lua_touserdata
                 U lua_type
0000000000002240 t push_column
0000000000001c90 t register_tm_clones
                 U __sprintf_chk@@GLIBC_2.3.4
                 U sqlite3_busy_timeout
                 U sqlite3_changes
                 U sqlite3_close
                 U sqlite3_column_blob
                 U sqlite3_column_bytes
                 U sqlite3_column_count
                 U sqlite3_column_decltype
                 U sqlite3_column_double
                 U sqlite3_column_int64
                 U sqlite3_column_name
                 U sqlite3_column_text
                 U sqlite3_column_type
                 U sqlite3_errmsg
                 U sqlite3_exec
                 U sqlite3_finalize
                 U sqlite3_free
                 U sqlite3_last_insert_rowid
                 U sqlite3_mprintf
                 U sqlite3_open
                 U sqlite3_prepare
                 U sqlite3_reset
                 U sqlite3_step
                 U __stack_chk_fail@@GLIBC_2.4
                 U strchr@@GLIBC_2.2.5
00000000002042f0 d __TMC_END__

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by Spyhawk almost 3 years ago

Again, try compiling sqlite3.so with Lua 5.3 support and see if symbols are provided.

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by eLBati almost 3 years ago

Downloaded LuaSQLite3 from http://lua.sqlite.org/index.cgi/home
compiled using lua 5.3
(setting

dependencies = {
    "lua >= 5.3, < 5.4" 
}

in lsqlite3-0.9.3-0.rockspec

Still

U lua_settop
U lua_checkstack

Same procedure an a different system (i686), same result.

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by eLBati almost 3 years ago

Ok, here is what I did:
- downloaded LUA 5.3 http://www.lua.org/download.html
- copied its header files to /usr/include/lua5.3
- downloaded LUASQL https://github.com/keplerproject/luasql
- run first step of sudo make sqlite3:

gcc -O2 -std=gnu99 -Wall -Wmissing-prototypes -Wmissing-declarations -pedantic -fPIC  -I/usr/include/lua5.3 -DLUASQL_VERSION_NUMBER='"2.3.0"'  -c src/luasql.c -o src/luasql.o

- copied qagame.mp.i386.so to /usr/lib/libqagame.so and /usr/lib/qagame.mp.i386.so
- run modified second step of sudo make sqlite3:
gcc -O2 -std=gnu99 -Wall -Wmissing-prototypes -Wmissing-declarations -pedantic -fPIC  -I/usr/include/lua5.3 -DLUASQL_VERSION_NUMBER='"2.3.0"'  src/ls_sqlite3.c -o src/sqlite3.so -shared src/luasql.o -I/opt/local/include -L/usr/lib -lqagame -lsqlite3 -Wl,-z,defs
where -lqagame indicates to use /usr/lib/libqagame.so

So now:

$ ldd src/sqlite3.so 
    linux-gate.so.1 =>  (0xb7770000)
    qagame.mp.i386.so => /usr/lib/qagame.mp.i386.so (0xb494d000)
    libsqlite3.so.0 => /usr/lib/i386-linux-gnu/libsqlite3.so.0 (0xb4872000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb46b6000)
    libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb453f000)
    libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb44f2000)
    libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb44d4000)
    libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb44b7000)
    libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb44b1000)
    /lib/ld-linux.so.2 (0x800d1000)

Then, copied to legacy/lualibs/luasql/sqlite3.so and now xpsave.lua can run.

Thanks Spyhawk for your support

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by IR4T4 almost 3 years ago

We should create and ship this lib with installs.

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by IR4T4 over 2 years ago

eLBati, why are you linking to/using lib qagame?

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by eLBati over 2 years ago

IR4T4 wrote:

eLBati, why are you linking to/using lib qagame?

Because it contains missing symbols, like lua_settop

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by IR4T4 over 2 years ago

It’s a bit strange. lua_settop f.e. is pure Lua function (see lua.h) and only called in Lua (lib/lua/src) - same with lua_checkstack. What happens on your side when you don’t link qagame and link liblua instead?

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by eLBati over 2 years ago

IR4T4 wrote:

It’s a bit strange. lua_settop f.e. is pure Lua function (see lua.h) and only called in Lua (lib/lua/src) - same with lua_checkstack. What happens on your side when you don’t link qagame and link liblua instead?

I don’t know.

Actually I’m not using sqlite anymore, but:
https://dev.etlegacy.com/issues/234#note-19

RE: undefinied symbol with Lua 5.1 and luasql lib - Added by Timothy about 2 years ago

I tried linking liblua and fixed the unknown symbol error.

Running a modified second step of the makefile (I added -llua5.1):

gcc -O2 -std=gnu99 -Wall -Wmissing-prototypes -Wmissing-declarations -pedantic -fPIC -I/usr/include/lua5.2 -DLUASQL_VERSION_NUMBER='"2.3.1"' src/ls_mysql.c -o src/mysql.so -shared src/luasql.o -I/usr/include/mysql -L/usr/lib -lmysqlclient -llua5.1 -lz

I compared the dependencies with a different 'mysql.so’ lib I already had and noticed that 'liblua5.1’ was missing from the list. Linking it manually solved the issue for me.

(1-21/21)