lua-users home
lua-l archive

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


On Fri, 13 Feb 2004, Diego Nehab wrote:

> Hi,
>
> I agree the distribution sucks. I will try to improve it for the next
> release. The next alpha version is comming soon, to be followed shortly
> by a beta version.
>
> > I have already compiled Lua 5 successfully. For LuaSocket I only
> > succeeded in creating a libluasocket.a file when I disabled
> > -DLUASOCKET_COMPILED flag. I don't know how to create .lch files used
> > for -DLUASOCKET_COMPILED flag. I figured that when using
> > -DLUASOCKET_COMPILED flag is should get a file named libluasocket.so. I
> > also understood that -DLUASOCKET_COMPILED flag is recommended.
>
> LuaSocket has a C part and a Lua part. The LUASOCKET_COMPILED flag asks
> LuaSocket to embed the Lua part inside the library. The other option is
> to load the files from disk, which require them to be accessible to
> your executable in run-time.
>
> To create the lch, first compile the Lua files with luac, then use the
> bin2c (in lua/etc or the bin2c.lua that has been recently mentioned
> in the list) utility to generate the lch. After the lch's are ready,
> you can compile the library with LUASOCKET_COMPILED.
>
> > But how I can use for example libluasocket.a file in the regular
> > stand-alone interpreter of Lua 5?
>
> If you don't want to recompile your Lua 5 interpreter, you will need to
> generate a dynamic library for LuaSocket, and use loadlib to load it.
> Otherwise, just add a call to luaopen_socket  to lua.c (near to
> luaopen_math, for instance) and recompile the interpreter.
>
> []s,
> Diego.
>

Hi.

Thanks for the help! With luac and bin2c combination I managed to compile
LuaSocket library with -DLUASOCKET_COMPILED flag. But I still get
libluasocket.a file instead of libluasocket.so. I tried to make a dynamic
libary using command "make dyn" but I get following error:

...
sendto                              0x3d8       usocket.o
listen                              0x144       usocket.o
sock_createstrerror                 0xc0        usocket.o
read                                0x4b8       usocket.o
accept                              0x21c       usocket.o
ld: fatal: relocations remain against allocatable but non-writable
sections
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `libluasocket.so.2.0'
>

I have run all lua files with lua2c and bin2 programs twice to make sure
that everything is ok. When I try command "make install" cp cannot
access libluasocket.so.2.0 file. So I figured out that I must get my
library in .so form. When I tried "make clean" the two last rm's were empty:

> make clean
rm -f luasocket.o  timeout.o  buffer.o  io.o  auxiliar.o  select.o  inet.o
tcp.o  udp.o  usocket.o
rm -f libluasocket.so.2.0
rm -f libluasocket.a
rm -f luasocket
rm -f
rm -f
>


Regards
Floru