lua-users home
lua-l archive

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


Hi people,

I'm trying to release a new version of the Debian package of Lua
4.0, but I'm stuck with an error concerning dynamic linking...

Here's the whole story. For personal reasons I wanted to have a Lua
with a "loadlib" function that would let me link with ".so"s
containing new Lua functions; so I took the "loadlib.c" file of cgilua
and created another Lua library file, "libdllua.so", with it, and
another binary, "dllua", that links with that library and registers
its functions.

Note: loadlib.c needs the functions dlopen, dlsym and dlclose, that
live in libdl. If I had just added loadlib.c to liblualib then
everybody would have to use "gcc -llua -llualib -ldl" instead of
"gcc -llua -llualib" and that would make compilation scripts would
crash. That's why I had to create an extra library and an extra
binary.

But my "dllua" was segfaulting at very simple Lua programs, and when I
tried to find what was wrong I discovered that its list of libraries
to link with was severely brain-damaged:

/usr/src/lua-4.0/debian/tmp-lua/usr# ldd bin/lua bin/dllua
bin/lua:
        liblua.so => /usr/lib/liblua.so (0x40021000)
        liblualib.so => /usr/lib/liblualib.so (0x40032000)
        libm.so.6 => /lib/libm.so.6 (0x40040000)
        libc.so.6 => /lib/libc.so.6 (0x4005d000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
bin/dllua:
        libdl.so.2 => /lib/libdl.so.2 (0x40021000)
        libm.so.6 => /lib/libm.so.6 (0x40024000)
        libc.so.6 => /lib/libc.so.6 (0x40042000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

and when I tried to discover the causes for that I got brain-damaged
too: I can't figure out why in some cases gcc creates a binary with
the right DL info and in some cases it doesn't (tee the output of
creating the package with "debian/rules binary" and search for "dllua"
and "ldd" to see what I'm talking about) and why stripping seems to
drops DL information.

I need help.

P.S.: I have sent this message:

  http://lists.debian.org/debian-mentors-0107/msg00253.html

to a Debian list but got no answer yet.

Cheers,
  Eduardo Ochs
  http://angg.twu.net/
  edrx@inx.com.br