lua-users home
lua-l archive

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


On Sun, 23 Jan 2011 14:05:06 -0200, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
>Then it seems that socket.so needs some other symbols, probably
>a system library or something.

As I was reading more about compiling, I saw the "-static" option, so
decided to give it a try when compiling the Lua interpreter:

================
bfin-linux-uclibc-gcc -o lua -static
-L/usr/src/baps/uClinux-dist/staging/usr/lib
-L/usr/src/baps/uClinux-dist/lib -L/usr/src/baps/uClinux-dist/root/lib
-L/var/tmp/sqlite-amalgamation-3070400 -lcrypt -ldl -lm -O2 -Wall
-Wmissing-prototypes -Wmissing-declarations
-I/usr/src/baps/uClinux-dist/staging/usr/include
-I/var/tmp/sqlite-amalgamation-3070400 -DLUA_USE_POSIX
-DLUA_USE_DLOPEN lua.o liblua.a

liblua.a(lvm.o): In function `.L206':
lvm.c:(.text+0x956): undefined reference to `_pow'
lvm.c:(.text+0x970): undefined reference to `_floor'
...
loadlib.c:(.text+0xb1e): undefined reference to `_dlclose'
collect2: ld returned 1 exit status
make[2]: *** [lua] Error 1
make[2]: Leaving directory `/var/tmp/lua-5.1.4/src'
make[1]: *** [generic] Error 2
make[1]: Leaving directory `/var/tmp/lua-5.1.4/src'
make: *** [generic] Error 2
================

Could it be that the libraries that were used with Lua aren't
available on the appliance, and would explain the error I'm getting
when trying to load a Lua module?

> If you're sure ldd is not available (perhaps it exists but is not in your path),
> try nm -u -g socket.so and see which undefined symbols exist.
>  (I hope nm exists in the system.)

Unfortunately, using "find / -name", neither ldd nor nm are available
in the appliance :-/

However, it seems to work OK when run on the Ubuntu workstation:

ubuntu:/var/tmp/luasocket-2.0.2/src# nm -u -g socket.2.0.2.so
         w __Jv_RegisterClasses
         w ___cxa_finalize
         w ___deregister_frame_info@@GCC_3.0
         U ___errno_location
         U ___h_errno_location
         w ___register_frame_info@@GCC_3.0
         U _accept
...

>BTW, I found this ldd for uClinux with Google but I can't vouch for it.
>http://pt.sourceforge.jp/cvs/view/uclinux-h8/uClibc/utils/ldd.c?hideattic=0&revision=1.1.1.2&view=markup&sortby=date

Thanks much, but I got a lot of errors when trying to compile it:

================
ubuntu:/var/tmp/ldd# make
bfin-linux-uclibc-gcc -O2 -Wall -Wmissing-prototypes
-Wmissing-declarations -I/usr/src/baps/uClinux-dis
t/staging/usr/include -I/var/tmp/sqlite-amalgamation-3070400 -static
-L/usr/src/baps/uClinux-dist/stagi ng/usr/lib
-L/usr/src/baps/uClinux-dist/lib -L/usr/src/baps/uClinux-dist/root/lib
-L/var/tmp/sqlite-ama lgamation-3070400 -lcrypt -ldl -lm -o ldd ldd.c

ldd.c:42:19: error: bswap.h: No such file or directory
ldd.c:48:21: error: dl-defs.h: No such file or directory
etc.
================

I also checked the latest uClinux-dist (from 2009), and it doesn't
seem to include "ldd" either:

ubuntu:/var/tmp# ls -al
drwxr-xr-x 14 root root      4096 2009-12-24 09:37 uClinux-dist
-rw-r--r--  1 root root 473128809 2011-01-23 18:01
uClinux-dist-2009R1.1-RC4.tar.bz2

ubuntu:/var/tmp# find ./uClinux-dist -name "ldd*"
(nothing)

I find this a bit strange, since "ldd" is such a basic tool.

So at this point...
1. I can run a basic Lua script
2. I can load a basic Lua module
3. Any standard Lua module fails with "Unable to resolve symbol"

I'll try to find an ldd that I can cross-compile and see what it says.

Thank you.