lua-users home
lua-l archive

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


I've successfully compiled lua 5.0 and the current version of luasocket
2.0. In the luasocket source directory (etc/README), the author states
that he is able to use luasocket from the stand-alone lua interpreter by
using the following environment variables:

    LUA_PATH=/usr/local/lua/?/?.lua
    LUA_INIT=@/usr/local/lua/lua.lua
    LUA_FUNCNAME=_?
    LUA_LIBNAME=/usr/local/lua/?/lib?.dylib

I'm using Linux on x86 with bash, so for me that becomes:

export LUA_PATH="/usr/local/lua/?/?.lua"
export LUA_INIT="@/usr/local/lua/lua.lua"
export LUA_FUNCNAME="_?"
export LUA_LIBNAME="/usr/local/lua/?/lib?.so"

However, when I try to run anything that use luasocket I get the
following error:

$ cd ~/src/luasocket-2.0-alpha
$ lua -l luasocket tests/urltest.lua
lua: /usr/local/lua/luasocket/luasocket.lua:2:
/usr/local/lib/liblualib.so: undefined symbol: _luaopen_socket
stack traceback:
        [C]: in function `error'
        /usr/local/lua/luasocket/luasocket.lua:2: in main chunk
        [C]: in function `require'
        [C]: ?

I believe I have gotten everything in stalled in the right places, see
output at the end of this posting.

If anybody has any clues on why it is not properly picking up the
libluasocket.so file, please let me know.

Regards,

Marius K.

$ ls -lR /usr/local/lua/
/usr/local/lua/:
total 8
-rw-r--r--    1 root     root          354 Jan 26 16:24 lua.lua
drwxr-xr-x    2 root     root         4096 Jan 26 16:24 luasocket

/usr/local/lua/luasocket:
total 112
lrwxrwxrwx    1 root     root           44 Jan 26 16:24 libluasocket.so -> /usr/local/lua/luasocket/libluasocket.so.2.0
-rwxr-xr-x    1 root     root       100166 Jan 26 16:24 libluasocket.so.2.0
-rw-r--r--    1 root     root         1340 Jan 26 16:24 luasocket.h
-rw-r--r--    1 root     root          163 Jan 26 16:24 luasocket.lua

>From lua-5 config:

LOADLIB= -DUSE_DLOPEN=1
DLLIB= -ldl
MYLDFLAGS= -Wl,-E
NUMBER= -DLUA_USER_H='"../etc/luser_number.h"' -DUSE_FASTROUND
EXTRA_LIBS= -lm
USERCONF=-DLUA_USERCONFIG='"$(LUA)/etc/saconfig.c"' -DUSE_READLINE
EXTRA_LIBS= -lm -ldl -lreadline -lncurses # -lhistory -lcurses -lncurses
CC= gcc
WARN= -Wall
MYCFLAGS= -O3 -fomit-frame-pointer -fPIC