lua-users home
lua-l archive

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


Quoting Diego Nehab <diego@tecgraf.puc-rio.br>:

> > (1) make; make install created mime.so.x.y.z and
> > socket.so.x.y.z, but it did not create symbolic links
> > (mime.so and socket.so) to those files.
> > Seems like mime.so and socket.so should be created.
>
> Not really. It should have created socket/core.so and
> mime/core.so. Did this not happen?

Yes, those files were created, and they are apparently not sufficient,
to judge by error messages from lua.

Before I go into details, let me state that I did RTFM.

I see that make install copied socket/core.so to
/usr/local/lib/lua/5.1/socket/.

When I try various assignments to LUA_CPATH, I find that
lua -l socket
fails, as shown here:

robertdodier@boulder ~]$ export LUA_CPATH='/usr/local/lib/lua/5.1'
robertdodier@boulder ~]$ lua -l socket
ua: error loading module 'socket' from file '/usr/local/lib/lua/5.1':
       /usr/local/lib/lua/5.1: cannot read file data: Is a directory
robertdodier@boulder ~]$ export LUA_CPATH='/usr/local/lib/lua/5.1/?'
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: cannot read file data: Is a directory
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: cannot read file data: Is a directory
robertdodier@boulder ~]$ export LUA_CPATH='/usr/local/lib/lua/5.1/socket/?'
robertdodier@boulder ~]$ lua -l socket
ua: module 'socket' not found:
       no field package.preload['socket']
       no file './socket.lua'
       no file '/usr/share/lua/5.1/socket.lua'
       no file '/usr/share/lua/5.1/socket/init.lua'
       no file '/usr/lib/lua/5.1/socket.lua'
       no file '/usr/lib/lua/5.1/socket/init.lua'
       no file '/usr/local/lib/lua/5.1/socket/socket'
robertdodier@boulder ~]$ export LUA_CPATH='/usr/local/lib/lua/5.1/socket/?.so'
robertdodier@boulder ~]$ lua -l socket
ua: module 'socket' not found:
       no field package.preload['socket']
       no file './socket.lua'
       no file '/usr/share/lua/5.1/socket.lua'
       no file '/usr/share/lua/5.1/socket/init.lua'
       no file '/usr/lib/lua/5.1/socket.lua'
       no file '/usr/lib/lua/5.1/socket/init.lua'
       no file '/usr/local/lib/lua/5.1/socket/socket.so'
robertdodier@boulder ~]$ export
LUA_CPATH='/usr/local/lib/lua/5.1/socket/core.so'
robertdodier@boulder ~]$ lua -l socket
ua: error loading module 'socket' from file
'/usr/local/lib/lua/5.1/socket/core.so':
       /usr/local/lib/lua/5.1/socket/core.so: undefined symbol: luaopen_socket

It seems odd that nm /usr/local/lib/lua/5.1/socket/core.so
reports that luaopen_socket_core is defined (i.e. marked by T) in core.so;
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.

Thanks for any light you can shed on this problem.

Robert Dodier