lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index] wrote:
> [...]
> robertdodier@boulder ~]$ export
> LUA_CPATH='/usr/local/lib/lua/5.1/socket/'
> robertdodier@boulder ~]$ lua -l socket
> ua: error loading module 'socket' from file
> '/usr/local/lib/lua/5.1/socket/':
>        /usr/local/lib/lua/5.1/socket/ undefined symbol:
> luaopen_socket 
> It seems odd that nm /usr/local/lib/lua/5.1/socket/
> reports that luaopen_socket_core is defined (i.e. marked by T) in
>; maybe that is the function that lua is looking for. 
> I tried other assignments (unsuccessful) to LUA_CPATH and LUA_PATH.
> The only thing that works is:
> cd /tmp/luasocket-2.0.1/src # i.e. cd to the build directory export
> LUA_CPATH='./?.so' 
> lua -l socket
> # now I get the lua interactive prompt
> Maybe someone can explain
> (1) what is supposed to appear in /usr/local/lib/lua/5.1/socket
> (2) what is the appropriate setting for LUA_CPATH and/or LUA_PATH.

Just to clarify things, socket.lua contains a Lua module, and
socket/ contains *ANOTHER* module. Both work together, but what
is documented on LuaSocket website is socket.lua, not socket/

Now, as you use -lsocket switch, I assume you want to load the normal
LuaSocket. In that case you have to configure LUA_PATH to point to that
socket.lua, and also, as socket.lua will require socket/, you
must make LUA_CPATH point to socket/

Assuming that you have these files there:

Your LUA_PATH and LUA_CPATH should look something like :
export LUA_PATH='/usr/local/share/lua/5.1/?.lua;;'
export LUA_CPATH='/usr/local/lib/lua/5.1/?.so;;'

And if you really want to load socket.core directly as you stated in
some previous email, you must use the -lsocket.core command line switch
instead of -lsocket.