NetBSD-Users archive

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

Re: lua-socket installation



Andrew wrote:
> Hi,
> I've been trying without success for a while to compile and install
> /usr/pkgsrc/net/lua-socket
> It tells me it installed correctly, I've installed it for lua 5.3, I had to
> manually update the LUA_PATH and LUA_CPATH variables, but now when I go to
> load the module through require("socket") it throws an error:
> 
> Lua 5.3.2  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> > require("socket")
> error loading module 'socket' from file
> '/usr/lib/lua/5.3/usr/pkg/share/lua/5.3/':
>         /usr/lib/lua/5.3/usr/pkg/share/lua/5.3/:1: unexpected symbol near
> '<\205>'
> stack traceback:
>         [C]: in ?
>         [C]: in function 'require'
>         stdin:1: in main chunk
>         [C]: in ?
> 
> This has happened when I used the source from pkgsrc and downloaded from
> git.

Your last problem is likely because you didn't append /?.lua to your LUA_PATH.

I compiled lua53-socket and I can confirm that there is a problem with it:

> return require'socket'
error loading module 'socket.core' from file '/usr/pkg/lib/lua/5.3/socket/core.so':
        /usr/pkg/lib/lua/5.3/socket/core.so: Undefined symbol "luaL_checkint" (symnum = 50)
stack traceback:
        [C]: in ?
        [C]: in function 'require'
        /usr/pkg/share/lua/5.3/socket.lua:12: in main chunk
        [C]: in function 'require'
        stdin:1: in main chunk
        [C]: in ?

It's because lua-socket isn't 5.3 ready:

$ make
...
luasocket.c: In function 'global_skip':
luasocket.c:67:18: warning: implicit declaration of function 'luaL_checkint' [-Wimplicit-function-declaration]
     int amount = luaL_checkint(L, 1);
                  ^
...
$ lynx /usr/pkg/share/doc/lua-5.3/manual.html
...
     * Macros to project non-default integer types (luaL_checkint, luaL_optint, luaL_checklong, luaL_optlong) were deprecated. Use their equivalent over lua_Integer with a type cast
       (or, when possible, use lua_Integer in your code).

It should be trivial to fix.

Alex


Home | Main Index | Thread Index | Old Index