lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Did you link your embedding program statically? Could be an explanation ...

Graham Henstridge wrote:
Hi
I have been banging my head on this simple problem. The archives don't seem to have an answer.

Running linux 2.6.19 on an ARM926. 
Have a C program with lua embedded that invokes lua, loads libraries, then executes a lua script which has a   require"socket.unix"  statement that fails. 
Running the standard lua interpreter with   require"socket.unix"   works just fine. 

Where could I have gone wrong? My pertinent(?) C code is:
if ( (L = lua_newstate()) ) {
... // open the libraries then ...
status = luaL_loadfile( L, /etc/capgo/process.lua );
...
status = lua_pcall(L, 0, LUA_MULTRET, 0);  

Which fails with status = LUA_ERRRUN when process.lua attempts to load a C library with:
require "socket.unix"

Which bombs with:
"error loading module 'socket.unix' from file '/urs/lib/socket/unix.so':
/urs/lib/socket/unix.so: undefined symbol: lua_insert

So the question is, how can "undefined symbol" come about in my program but not in lua.c, when both are built against the same static lualib.a? 

Help greatly appreciated.

Graham Henstridge