Cant fix error with lua on psp

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
YourNerdyJoe
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 79
Joined: Sun Oct 02, 2011 3:28 pm
Current Project: Top secret (not really) Top-Down Shooter for GBA
Favorite Gaming Platforms: GBA, Gamecube, PC, 3DS
Programming Language of Choice: C/C++
Contact:

Cant fix error with lua on psp

Post by YourNerdyJoe »

This has been bothering me for a couple of days now and I cant figure out how to solve this

Code: Select all

psp-g++ -I. -Ic:/pspsdk/psp/sdk/include -O2 -G0 -Wall -g -I. -Ic:/pspsdk/psp/sdk/include -O2 -G0 -Wall -g -fno-exceptions -fno-rtti -g -D_PSP_FW_VERSION=150   -c -o main.o main.cpp
1>  psp-gcc -I. -Ic:/pspsdk/psp/sdk/include -O2 -G0 -Wall -g -D_PSP_FW_VERSION=150  -L. -Lc:/pspsdk/psp/sdk/lib   main.o -lc -lm -llua -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o luaTest.elf
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lvm.o): In function `Arith':
1>  lvm.c:(.text+0xfa0): undefined reference to `pow'
1>  lvm.c:(.text+0xff8): undefined reference to `floor'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lvm.o): In function `luaV_execute':
1>  lvm.c:(.text+0x2660): undefined reference to `pow'
1>  lvm.c:(.text+0x2694): undefined reference to `floor'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lcode.o): In function `codearith':
1>  lcode.c:(.text+0x1720): undefined reference to `pow'
1>  lcode.c:(.text+0x1764): undefined reference to `floor'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lmathlib.o): In function `math_tan':
1>  lmathlib.c:(.text+0x1e4): undefined reference to `tan'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lmathlib.o): In function `math_tanh':
1>  lmathlib.c:(.text+0x23c): undefined reference to `tanh'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lmathlib.o): In function `math_sqrt':
1>  lmathlib.c:(.text+0x294): undefined reference to `sqrt'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lmathlib.o): In function `math_sin':
1>  lmathlib.c:(.text+0x2ec): undefined reference to `sin'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lmathlib.o): In function `math_sinh':
1>  lmathlib.c:(.text+0x344): undefined reference to `sinh'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lmathlib.o): In function `math_floor':
1>  lmathlib.c:(.text+0x4ec): undefined reference to `floor'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lmathlib.o): In function `math_random':
1>  lmathlib.c:(.text+0x63c): undefined reference to `floor'
1>  lmathlib.c:(.text+0x6d0): undefined reference to `floor'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lmathlib.o): In function `math_pow':
1>  lmathlib.c:(.text+0x784): undefined reference to `pow'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lmathlib.o): In function `math_log':
1>  lmathlib.c:(.text+0x878): undefined reference to `log'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lmathlib.o): In function `math_log10':
1>  lmathlib.c:(.text+0x8d0): undefined reference to `log10'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lmathlib.o): In function `math_fmod':
1>  lmathlib.c:(.text+0xa4c): undefined reference to `fmod'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lmathlib.o): In function `math_exp':
1>  lmathlib.c:(.text+0xab4): undefined reference to `exp'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lmathlib.o): In function `math_cos':
1>  lmathlib.c:(.text+0xb0c): undefined reference to `cos'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lmathlib.o): In function `math_cosh':
1>  lmathlib.c:(.text+0xb64): undefined reference to `cosh'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lmathlib.o): In function `math_ceil':
1>  lmathlib.c:(.text+0xbbc): undefined reference to `ceil'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lmathlib.o): In function `math_atan':
1>  lmathlib.c:(.text+0xc14): undefined reference to `atan'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lmathlib.o): In function `math_atan2':
1>  lmathlib.c:(.text+0xca8): undefined reference to `atan2'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lmathlib.o): In function `math_asin':
1>  lmathlib.c:(.text+0xd10): undefined reference to `asin'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\liblua.a(lmathlib.o): In function `math_acos':
1>  lmathlib.c:(.text+0xd68): undefined reference to `acos'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\libc.a(lib_a-s_frexp.o): In function `frexp':
1>  ../../../../../../newlib-1.18.0/newlib/libm/mathfp/s_frexp.c:86: undefined reference to `numtest'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\libc.a(lib_a-s_ldexp.o): In function `ldexp':
1>  ../../../../../../newlib-1.18.0/newlib/libm/mathfp/s_ldexp.c:87: undefined reference to `numtest'
1>  ../../../../../../newlib-1.18.0/newlib/libm/mathfp/s_ldexp.c:107: undefined reference to `z_infinity'
1>  ../../../../../../newlib-1.18.0/newlib/libm/mathfp/s_ldexp.c:107: undefined reference to `z_infinity'
1>  ../../../../../../newlib-1.18.0/newlib/libm/mathfp/s_ldexp.c:107: undefined reference to `z_infinity'
1>  ../../../../../../newlib-1.18.0/newlib/libm/mathfp/s_ldexp.c:107: undefined reference to `z_infinity'
1>  ../../../../../../newlib-1.18.0/newlib/libm/mathfp/s_ldexp.c:112: undefined reference to `z_infinity'
1>  c:/pspsdk/bin/../lib/gcc/psp/4.3.5/../../../../psp/lib\libc.a(lib_a-s_ldexp.o):../../../../../../newlib-1.18.0/newlib/libm/mathfp/s_ldexp.c:112: more undefined references to `z_infinity' follow
1>  make: *** [luaTest.elf] Error 1
I've tried googling it but found nothing and even recompiled the lua lib but nothing works

Heres my code:

Code: Select all

//main.cpp
#include <pspkernel.h>
#include <pspdebug.h>
#include <lua.hpp>
#include <stdlib.h>
#include <math.h>
#define printf pspDebugScreenPrintf
PSP_MODULE_INFO("LUA TEST",0,1,1);

int exit_callback(int arg1,int arg2,void* common);
int CallbackThread(SceSize args,void* argp);
int SetupCallbacks();

int luafunct(lua_State* L);

//--------------------------------------------------------//
int main(int argc,char* argv[])
{
	pspDebugScreenInit();
	SetupCallbacks();
	lua_State* L = lua_open();
	luaL_openlibs(L);
	lua_register(L,"luafunct",luafunct);
	printf("Hello World!\n");
	luaL_dostring(L,"print(\"Print String\")\n");
	luaL_dofile(L,"test.lua");
	lua_close(L);
	sceKernelSleepThread();
	return 0;
}
//--------------------------------------------------------//
int exit_callback(int arg1,int arg2,void* common)
{
	sceKernelExitGame();
	return 0;
}

int CallbackThread(SceSize args,void* argp)
{
	int cbid;
	cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
	sceKernelRegisterExitCallback(cbid);
	sceKernelSleepThreadCB();
	return 0;
}

int SetupCallbacks()
{
	int thid = 0;
	thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
	if(thid >= 0) {
		sceKernelStartThread(thid, 0, 0);
	}
	return thid;
}

int luafunct(lua_State* L)
{
	printf("123\n");
	int x=654;
	printf("num: %d\n",x);
	return 0;
}
and the Makefile:

Code: Select all

TARGET = luaTest
OBJS = main.o

INCDIR =
CFLAGS = -O2 -G0 -Wall -g
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti -g
ASFLAGS = $(CFLAGS)

LIBDIR =
LDFLAGS =
LIBS = -lc -lm -llua

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = GfxTest

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Please help this is the only thing thats stopping me from porting my game in progress to psp
See that?.....
Exactly
https://yournerdyjoe.github.io/
Post Reply