I managed to compile Lua 5.1.4 for Palm webOS and now I'm trying to write an extension to use webOS' services from Lua. However, when I try to load my library, Lua reports:
undefined symbol: lua_pushlstring
Here's my code:
#define LUA_LIB
#include "lua.h"
#include "lauxlib.h"
static int hellopalm(lua_State *L) {
lua_pushliteral(L, "Hello, Palm!");
return 1;
}
static const luaL_reg palmlib[] = {
{ "hellopalm", hellopalm },
{ NULL, NULL }
};
LUALIB_API int luaopen_palm(lua_State *L) {
luaL_register(L, "palm", palmlib);
return 1;
}
Here's my Makefile:
LUADIR= ../lua-5.1.4/lua-webos
CC= arm-none-linux-gnueabi-gcc
CFLAGS= -O2 -Wall -shared -nostdlib -mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp
INCLUDES= -I$(LUADIR)/include
RM= rm -f
LIBNAME= palmlib.so
SOURCES= palmlib.c
default: $(LIBNAME)
clean:
$(RM) $(LIBNAME)
$(LIBNAME): palmlib.c
$(CC) $(CFLAGS) $(INCLUDES) $(SOURCES) -o $@
I know lua_pushliteral
is just a macro that calls lua_pushlstring
, so that's where the error is coming from. None of the push_*
variants seem to work at all. I suspect something is wrong with my Makefile.
Any ideas?