lua-users home
lua-l archive

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


On Thu, 14 Apr 2011 13:14:27 -0300 (BRT), Tomas Guisasola Gorham
<tomas@tecgraf.puc-rio.br> wrote:
> 	What symbol could not be resolved?  Was there any other message?

No, that's all there is :-/

I noticed something strange, though: Although they are compiled
exactly the same way, while the first dummy library loads OK, the
second triggers the same error message:

================== dummy.c
#include <stdio.h>
#include "lua.h"

int luaopen_dummy (lua_State *L) {
    puts("Hello from dummy");
    return 0;
}
================== dummy.mk
BASE=/usr/src/baps

CC=/usr/src/baps/opt/uClinux/bfin-linux-uclibc/bin/bfin-linux-uclibc-gcc
LD=/usr/src/baps/opt/uClinux/bfin-linux-uclibc/bin/bfin-linux-uclibc-ld

CFLAGS=-O2 -Wall -I/usr/src/lua-5.1.4/src
-I$(BASE)/uClinux-dist/linux-2.6.x/include -I$(BASE)/uClinux-dist/lib
LDFLAGS=-shared -fPIC

================== dummy2.c
#include <stdio.h>
#include "lua.h"

int luaopen_dummy (lua_State *L) {
 puts("Hello from dummy");
 lua_pushnil(L);
 puts("Bye from dummy");
 return 0;
}


dummy.so:
        $(CC) $(CFLAGS) $(LDFLAGS) -o $@ dummy.c

================== dummy2.mk
BASE=/usr/src/baps

CC=/usr/src/baps/opt/uClinux/bfin-linux-uclibc/bin/bfin-linux-uclibc-gcc
LD=/usr/src/baps/opt/uClinux/bfin-linux-uclibc/bin/bfin-linux-uclibc-ld

CFLAGS=-O2 -Wall -I/usr/src/lua-5.1.4/src
-I$(BASE)/uClinux-dist/linux-2.6.x/include -I$(BASE)/uClinux-dist/lib
LDFLAGS=-shared -fPIC

dummy2.so:
        $(CC) $(CFLAGS) $(LDFLAGS) -o $@ dummy2.c
==================        
/var/tmp> ./lua
./lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio

> require "dummy"
Hello from dummy

> require "dummy2"
error loading module 'dummy2' from file '/var/tmp/dummy2.so':
  Unable to resolve symbol
stack traceback:
  [C]: ?
  [C]: in function 'require'
  stdin:1: in main chunk
  [C]: ?
==================      

Does someone have an idea?

Thank you.