Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google Log In with Steam Sign In
  • Create Account
Photo

using luasocket in a luascript

- - - - -

  • Please log in to reply
26 replies to this topic

#1
OFFLINE   belstgut

belstgut

    Member

  • Members
  • PipPip
  • 32 posts
4
A step in the right direction
  • LocationMering, Germany

Hi,

 

I am currently trying to get luasocket working in one of my luascripts.

 

I got luasocket compiled against the 32bit liblua53 and moved it to silent/lualibs.

 

I still got following problem though. It seems like silent lua extension does NOT reexport modules like lua_gettop

 

I get: socket/core.so: undefined symbol: lua_gettop

 

i found this: https://github.com/siffiejoe/lua-moon/

 

I am not sure if I just failed to compile it correctly but after requireing sofix in my lua module I still get the same error. (the require works though.)


Edited by belstgut, 13 June 2016 - 11:04 PM.


#2
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland

You're using the qagame binary from the dynamic_lua directory in the zip? That is necessary for external libraries to be used. Other than that, I don't know what could be wrong. Maybe TheSilencerPL has some insight.



#3
OFFLINE   belstgut

belstgut

    Member

  • Members
  • PipPip
  • 32 posts
4
A step in the right direction
  • LocationMering, Germany

woah thanks. linking it to the qagame shared object worked. I was trying to link it against liblua53.so.

 

setting MOON_DLFIX_LIBNAME to qagame.i386.so worked

 

thanks



#4
OFFLINE   belstgut

belstgut

    Member

  • Members
  • PipPip
  • 32 posts
4
A step in the right direction
  • LocationMering, Germany

Am I blind or is there really no edit function for posts?

 

well anyway,

 

Now the module loads and works and stuff, BUT I cant do http requests.

It always times out.

tcpdump shows a successful TCP Handshake

and after the timeout (eg 10s)

I can see the TCP FIN "handshake"

 

But I do NOT see any actual packages transmitted.

 

any ideas?

 

EDIT: hmm odd. I can edit this post, but not the other one.

 

well after a bit of investigating I came to the conclusion, that while a socket:connect() works (tcp handshake and so on)

 

nothing happens with a socket:send('some data')

 

it just times out.

 

So the problem is not related to the http.lua module. but already at the lowerlevel tcp module.


Edited by belstgut, 14 June 2016 - 03:56 PM.


#5
OFFLINE   belstgut

belstgut

    Member

  • Members
  • PipPip
  • 32 posts
4
A step in the right direction
  • LocationMering, Germany

Currently trying it with the dynamic_lua qagame.

but I get the following:

 

 

PANIC: unprotected error in call to Lua API (core and library have incompatible numeric types)

 

‚ÄčI am using the lib from: http://packages.ubun...386/liblua5.3-0



#6
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland

I think we need to refer to TheSilencerPL with this problem. But just to clarify, do you get that error by only running some "Hello World" test script or does it appear when you load more functionalities from additional libraries?



#7
OFFLINE   belstgut

belstgut

    Member

  • Members
  • PipPip
  • 32 posts
4
A step in the right direction
  • LocationMering, Germany

I'll get that panic before any lua module gets loaded.

 

log: https://ptpb.pw/xB9r

 

Spoiler


Edited by belstgut, 16 June 2016 - 11:48 AM.


#8
OFFLINE   TheSilencerPL

TheSilencerPL

    Advanced Member

  • Management
  • PipPipPipPip
  • 3097 posts
216
On the road to fame
  • LocationPoland

silEnT mod is linked against lua 5.3.1 as far as I remember, and you are using 5.3.0 if I am correct - that might be the cause.



#9
OFFLINE   belstgut

belstgut

    Member

  • Members
  • PipPip
  • 32 posts
4
A step in the right direction
  • LocationMering, Germany

I am using 5.3.3 I'll try with 5.3.1

 

edit: same with 5.3.1


Edited by belstgut, 16 June 2016 - 04:39 PM.


#10
OFFLINE   belstgut

belstgut

    Member

  • Members
  • PipPip
  • 32 posts
4
A step in the right direction
  • LocationMering, Germany

http://www.lua.org/m...aL_checkversion since this is the call which raises the error, I assume, the lua versions are NOT the same.



#11
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland

The liblua you have is compiled as 32 bit binary with 32 bit integers?



#12
OFFLINE   belstgut

belstgut

    Member

  • Members
  • PipPip
  • 32 posts
4
A step in the right direction
  • LocationMering, Germany

yes. I have compiled it in a 32 chroot.

 

gs@server1 ~/wolfet % file /usr/lib/i386-linux-gnu/liblua.so.5.3 
/usr/lib/i386-linux-gnu/liblua.so.5.3: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=e7f186a10367b9209c168d910c84ed19199f6c40, not stripped
 
Full ELF info:
 

Edited by belstgut, 17 June 2016 - 11:03 AM.


#13
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland
// silencer
// LUA_32BITS to get 32-bit integers and 'float' and
// LUA_C89_NUMBERS to get 'long' and 'double, which was the traditional
// combination before 5.3.

/*
@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. You
** can also define LUA_32BITS in the make file, but changing here you
** ensure that all software connected to Lua will be compiled with the
** same configuration.
*/
#define LUA_32BITS


/*
@@ LUA_USE_C89 controls the use of non-ISO-C89 features.
** Define it if you want Lua to avoid the use of a few C99 features
** or Windows-specific features on Windows.
*/
#define LUA_USE_C89

We have these defined at the top of the luaconf.h. Maybe you need them too.



#14
OFFLINE   belstgut

belstgut

    Member

  • Members
  • PipPip
  • 32 posts
4
A step in the right direction
  • LocationMering, Germany

that seemed to be working.

 

Lua 5.3.1 with -DLUA_32BITS -DLUA_USE_C89

 

still cant send stuff over a socket though :(


Edited by belstgut, 18 June 2016 - 03:45 PM.


#15
OFFLINE   belstgut

belstgut

    Member

  • Members
  • PipPip
  • 32 posts
4
A step in the right direction
  • LocationMering, Germany

made a short video which hopefully explains my issue:

 

https://ptpb.pw/yV5R.webm



#16
OFFLINE   belstgut

belstgut

    Member

  • Members
  • PipPip
  • 32 posts
4
A step in the right direction
  • LocationMering, Germany

Btw, luasockets work in the systemwide lua interpreter. (5.3.1 32bit)

 

Lua 5.3.1  Copyright © 1994-2015 Lua.org, PUC-Rio
> http = require'socket.http'
> print(http.request('http://127.0.0.1'))
Hi there
        200     table: 0x80c1600        HTTP/1.1 200 OK
 
 
/usr/bin/lua5.3: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=5c238fe30c288fab06fd2c3e25bbffb575a48700, stripped
 


#17
OFFLINE   TheSilencerPL

TheSilencerPL

    Advanced Member

  • Management
  • PipPipPipPip
  • 3097 posts
216
On the road to fame
  • LocationPoland

I wonder if we need some flag in the lua to enable sockets, like LUA_SOCKET or something they have there maybe.

Or just linking against the luasocket library,



#18
OFFLINE   belstgut

belstgut

    Member

  • Members
  • PipPip
  • 32 posts
4
A step in the right direction
  • LocationMering, Germany
Curl works though. So sockets seem to be working. I tried lcurl which links against libcurl and it worked. I dont like the callback structure of curl though. So if anyone has a wrapper around that :)

#19
OFFLINE   belstgut

belstgut

    Member

  • Members
  • PipPip
  • 32 posts
4
A step in the right direction
  • LocationMering, Germany

Does noone has any more ideas? Or maybe its not even a problem with luasockets but with my take on it.

 

Can someone try and check if it works for you?



#20
OFFLINE   belstgut

belstgut

    Member

  • Members
  • PipPip
  • 32 posts
4
A step in the right direction
  • LocationMering, Germany

Nvm. I got it working. Dunno what changed But I compiled luasocket again and now it works. odd






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users