lua-users home
lua-l archive

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

On Mon, 24 Jan 2011 08:56:31 -0200, Luiz Henrique de Figueiredo
<> wrote:
>This is *not* the way to use LuaSocket! You need to install it somewhere.
>require "socket" should load socket.lua which in turn loads socket.core,
>typically from socket/

Damn... When I saw that the Makefile created two .so files, I figured
I could just copy those files in the same directory as the Lua
interpreter and call "require" to use them, instead of actually
checking with the documentation :-/

And to make matters worse, the error message (Unable to resolve
symbol") led me to believe it was a (cross-)compiling issue...

After going through those steps, I can successfully load the Socket

1. Go through LuaSocket's config/makefile and src/makefile to figure
out how to cross-compile this module and what to install where with
which name on the target host

2. LuaSocket requires a bunch of .lua scripts and the two shared
libraries, under a different name:

wget http://workstation/luasocket.binaries.tar.gz
tar xzvf luasocket.binaries.tar.gz

mkdir -p /usr/local/share/lua/5.1.4/socket
cp ltn12.lua mime.lua socket.lua /usr/local/share/lua/5.1.4/
cp http.lua tp.lua ftp.lua smtp.lua url.lua

mkdir -p /usr/local/lib/lua/5.1.4/mime
mkdir -p /usr/local/lib/lua/5.1.4/socket
cp /usr/local/lib/lua/5.1.4/socket/
cp /usr/local/lib/lua/5.1.4/mime/

vi /etc/profile:
export LUA_CPATH=/usr/local/lib/lua/5.1.4/?.so;?.so
export LUA_PATH=/usr/local/share/lua/5.1.4/?.lua;?.lua

> cd /var/tmp/
> ./lua
Lua 5.1.4  Copyright (C) 1994-2008, PUC-Rio
> socket = require("socket")
> print(socket._VERSION)
LuaSocket 2.0.2

Thanks much to you and everyone else in this thread, and sorry for
wasting your time. I'll pay more attention to what resources are
available for a given module.