Luasocket sample / static linking

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Luasocket sample / static linking

Eric Tetz
Two questions:

(1) I'm trying to statically link Luasocket into an app, and I'm
completely confounded by the module system. Does anyone know of an
open source project that statically links Luasocket to a Lua 5.1.x
that I could look at?

(2) Assuming I can get past step 1, I'd like to be able to validate.
There doesn't appear to be any http tests in the Luasocket package,
and as far as I can tell the only sample app that use http (cddb)
doesn't work. When I run it (e.g. lua5.1.exe cddb.lua classical
270b8617) I get:

lua5.1.exe: cddb.lua:35: attempt to call field 'get' (a nil value)
stack traceback:
        cddb.lua:35: in main chunk

I'm using the luasocket-2.0.2-lua-5.1.2-Win32-vc6.zip with the samples
in luasocket-2.0.2.tar.gz, both from LuaForge.

Thanks in advance. :)
Reply | Threaded
Open this post in threaded view
|

Re: Luasocket sample / static linking

Andreas Krinke
On Jun 6, 2010 at 6:22 AM, Eric Tetz wrote:
> (1) I'm trying to statically link Luasocket into an app, and I'm
> completely confounded by the module system. Does anyone know of an
> open source project that statically links Luasocket to a Lua 5.1.x
> that I could look at?

Scrupp [1] statically links LuaSocket. It's an application that embeds
Lua, so it isn't a clean Lua interpreter.

> (2) Assuming I can get past step 1, I'd like to be able to validate.
> There doesn't appear to be any http tests in the Luasocket package,
> and as far as I can tell the only sample app that use http (cddb)
> doesn't work. When I run it (e.g. lua5.1.exe cddb.lua classical
> 270b8617) I get:
>
> lua5.1.exe: cddb.lua:35: attempt to call field 'get' (a nil value)
> stack traceback:
>          cddb.lua:35: in main chunk

This example comes with Scrupp. Line 35 reads:

local body, code, headers = http.request(url)

This change should make it work.

Regards,
Andreas

[1] http://scrupp.sourceforge.net
Reply | Threaded
Open this post in threaded view
|

Re: Luasocket sample / static linking

Jan-Pieter Jacobs-3
In reply to this post by Eric Tetz
I know that MurgaLua[1] comes with Luasocket compiled in, and has a
statically compiled version for linux, for windows: no idea whether
it's statical or not, I'm not using windows that often.
You can find the last version that comes with the source here:[2]
and the most recent binary version here[3]

[1]: http://www.murga-projects.com/murgaLua/index.html
[2]: http://jpjacobs.ulyssis.org/progs/murgaLua-0.6.9.tar.gz
[3]: http://jpjacobs.ulyssis.org/progs/murgaLua-snapshot.tar.gz

Greetz

Jan-Pieter
* Eric Tetz <[hidden email]> [100610 12:00]:

> Two questions:
>
> (1) I'm trying to statically link Luasocket into an app, and I'm
> completely confounded by the module system. Does anyone know of an
> open source project that statically links Luasocket to a Lua 5.1.x
> that I could look at?
>
> (2) Assuming I can get past step 1, I'd like to be able to validate.
> There doesn't appear to be any http tests in the Luasocket package,
> and as far as I can tell the only sample app that use http (cddb)
> doesn't work. When I run it (e.g. lua5.1.exe cddb.lua classical
> 270b8617) I get:
>
> lua5.1.exe: cddb.lua:35: attempt to call field 'get' (a nil value)
> stack traceback:
>         cddb.lua:35: in main chunk
>
> I'm using the luasocket-2.0.2-lua-5.1.2-Win32-vc6.zip with the samples
> in luasocket-2.0.2.tar.gz, both from LuaForge.
>
> Thanks in advance. :)
--
You can check the integrity of this emailmessage with gpg.
Various gpg-frontends at http://www.gnupg.org/
My public key resides at http://jpjacobs.ulyssis.org/pubkey.asc
I use grml (http://grml.org/)

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Luasocket sample / static linking

dronten
In reply to this post by Eric Tetz
> (1) I'm trying to statically link Luasocket into an app, and I'm
> completely confounded by the module system. Does anyone know of an
> open source project that statically links Luasocket to a Lua 5.1.x
> that I could look at?

I have tried the same using mingw. Tried and failed. I succeeded with linking luasocket as static. And also in embedding the lua modules into the exe using tolua++. But the only thing I managed to do with it was to get some version number from it. Everything else failed. So the lua modules wasn't loaded in the right way.
Reply | Threaded
Open this post in threaded view
|

Re: Luasocket sample / static linking

Eric Tetz
Thanks for the info, guys.

Tim Channon was kind enough to send me a tool he wrote which complete
automated the binding. Thanks Tim!