lua on PSP (not lua player !)

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
zoret
Posts: 22
Joined: Sun Mar 19, 2006 7:57 pm

lua on PSP (not lua player !)

Post by zoret »

hi,

i have to read my own lua script without using the excellent (but too complete in my case) luaplayer
any ideas ?
i had a look inside the lua player samples but the lua lib files (header and lib) are not present...

thanks in advance !
PeterM
Posts: 125
Joined: Sat Dec 31, 2005 7:25 pm
Location: Edinburgh, UK
Contact:

Post by PeterM »

Check out http://www.lua.org and download the source, and the docs.

Hope this helps,
Pete
zoret
Posts: 22
Joined: Sun Mar 19, 2006 7:57 pm

Post by zoret »

yes i can indeed compile all by myself but just wanted to know if anybody had already compiled and created the lua libraries for the psp toolchain ?
it's just to not waste my time if it available somewhere ..

thanks !
PeterM
Posts: 125
Joined: Sat Dec 31, 2005 7:25 pm
Location: Edinburgh, UK
Contact:

Post by PeterM »

Sorry, I didn't realise that.

I think it's available on the PS2Dev Subversion server:
http://svn.ps2dev.org/listing.php?repna ... rev=0&sc=0

Pete
zoret
Posts: 22
Joined: Sun Mar 19, 2006 7:57 pm

Post by zoret »

great !! thanks a lot !
zoret
Posts: 22
Joined: Sun Mar 19, 2006 7:57 pm

Post by zoret »

it looks to contain what i'm looking for but i don't see any download button !??
i must be missing something ! :)
PeterM
Posts: 125
Joined: Sat Dec 31, 2005 7:25 pm
Location: Edinburgh, UK
Contact:

Post by PeterM »

Open up a cygwin window and type:
svn co svn://svn.ps2dev.org/psp/trunk/lua
zoret
Posts: 22
Joined: Sun Mar 19, 2006 7:57 pm

Post by zoret »

great it seems to work except i don't have the permission !? :-(
i've the following error :

svn: Can't connect to host 'syn.ps2dev.org': Connection refused


any ideas ?
PeterM
Posts: 125
Joined: Sat Dec 31, 2005 7:25 pm
Location: Edinburgh, UK
Contact:

Post by PeterM »

You've typed "syn.ps2dev.org" there - is that a typo?

The line I gave should work - it worked for me, I tested it before posting.

Pete
zoret
Posts: 22
Joined: Sun Mar 19, 2006 7:57 pm

Post by zoret »

yep you right, just a little error in what i've typed
now it's ok
thanks a lot !!
PeterM
Posts: 125
Joined: Sat Dec 31, 2005 7:25 pm
Location: Edinburgh, UK
Contact:

Post by PeterM »

You're welcome.

Pete
zoret
Posts: 22
Joined: Sun Mar 19, 2006 7:57 pm

Post by zoret »

ok now i can compile and test the lua sample
i've modified it and everything works perfectly
so i've tried to put some lua stuff in my own code

but when i try to link with lua libs : -llualib -llua (like in the lua sample !)
i've the following errors :

Code: Select all

Performing Makefile project actions
Makefile (30) : warning: overriding commands for target `kxploit'
c:/cygwin/usr/local/pspdev/psp/sdk/lib/build.mak (137) : warning: ignoring old commands for target `kxploit'
rm -f nXviewer.elf  nXviewer.o _libs/callbacks.o _libs/vram.o PARAM.SFO EBOOT.PBP EBOOT.PBP
C:/cygwin/usr/local/pspdev/bin/vs-psp-gcc -I. -Ic:/cygwin/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall   -c -o nXviewer.o nXviewer.c
C:/cygwin/usr/local/pspdev/bin/vs-psp-gcc -I. -Ic:/cygwin/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall   -c -o _libs/callbacks.o _libs/callbacks.c
C:/cygwin/usr/local/pspdev/bin/vs-psp-gcc -I. -Ic:/cygwin/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall   -c -o _libs/vram.o _libs/vram.c
C:/cygwin/usr/local/pspdev/bin/vs-psp-gcc -I. -Ic:/cygwin/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall  -L. -Lc:/cygwin/usr/local/pspdev/psp/sdk/lib   nXviewer.o _libs/callbacks.o _libs/vram.o -lpspgum -lpspgu -lm -lpspusb -lpspusbstor -llualib -llua -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o nXviewer.elf
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/liblualib.a(lmathlib.o): In function `math_tan':
lmathlib.c:(.text+0xd0): undefined reference to `tanf'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/liblualib.a(lmathlib.o): In function `math_asin':
lmathlib.c:(.text+0x110): undefined reference to `asinf'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/liblualib.a(lmathlib.o): In function `math_acos':
lmathlib.c:(.text+0x150): undefined reference to `acosf'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/liblualib.a(lmathlib.o): In function `math_atan':
lmathlib.c:(.text+0x190): undefined reference to `atanf'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/liblualib.a(lmathlib.o): In function `math_atan2':
lmathlib.c:(.text+0x1e8): undefined reference to `atan2f'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/liblualib.a(lmathlib.o): In function `math_ceil':
lmathlib.c:(.text+0x22c): undefined reference to `ceilf'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/liblualib.a(lmathlib.o): In function `math_mod':
lmathlib.c:(.text+0x2c4): undefined reference to `fmodf'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/liblualib.a(lmathlib.o): In function `math_sqrt':
lmathlib.c:(.text+0x31c): undefined reference to `sqrtf'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/liblualib.a(lmathlib.o): In function `math_pow':
lmathlib.c:(.text+0x378): undefined reference to `powf'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/liblualib.a(lmathlib.o): In function `math_log':
lmathlib.c:(.text+0x3bc): undefined reference to `logf'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/liblualib.a(lmathlib.o): In function `math_log10':
lmathlib.c:(.text+0x3fc): undefined reference to `log10f'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/liblualib.a(lmathlib.o): In function `math_exp':
lmathlib.c:(.text+0x43c): undefined reference to `expf'
collect2: ld returned 1 exit status
psp-fixup-imports nXviewer.elf
Error, could not find file nXviewer.elf
mksfo 'nXviewer' PARAM.SFO
psp-strip nXviewer.elf -o nXviewer_strip.elf
psp-strip: 'nXviewer.elf': No such file
pack-pbp EBOOT.PBP PARAM.SFO NULL  \ NULL NULL NULL  \ NULL  nXviewer_strip.elf NULL
ERROR: Could not open the file. (nXviewer_strip.elf)
make: *** [EBOOT.PBP] Error 255
i've searched for the maths functions asked but nothing (except this from lua package) contains these !!!

i really don't understand how the lua sample can link !
there's somthing strange here !!

any ideas welcome !

here is the makefile i use :

Code: Select all

TARGET = nXviewer
OBJS = nXviewer.o _libs/callbacks.o _libs/vram.o

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

LIBDIR =
LDFLAGS =
LIBS= -lpspgum -lpspgu -lm -lpspusb -lpspusbstor -llualib -llua

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = nXviewer

PSPSDK=c:/cygwin/usr/local/pspdev/psp/sdk#$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak

ifneq ($VS_PATH),)
CC       = C:/cygwin/usr/local/pspdev/bin/vs-psp-gcc
CXX      = C:/cygwin/usr/local/pspdev/bin/vs-psp-g++
endif


XTARGET = $(shell echo $(TARGET)000000 | cut -b1-6)
KXDIR = $(TARGET)
KXDUMMY = $(TARGET)%
 
kxploit: $(TARGET).elf $(PSP_EBOOT_SFO)
	mkdir -p "$(KXDIR)"
	$(STRIP) $(TARGET).elf -o $(KXDIR)/$(PSP_EBOOT)
	mkdir -p "$(KXDUMMY)"
	$(PACK_PBP) "$(KXDUMMY)/$(PSP_EBOOT)" $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON)  \
	$(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1)  \
	$(PSP_EBOOT_SND0) NULL $(PSP_EBOOT_PSAR) 
	cp -r $(KXDIR) $(PSP_MOUNT)/PSP/GAME/
	cp -r $(KXDUMMY) $(PSP_MOUNT)/PSP/GAME/ 
                
if someone could tell be wich library contains theses maths functions i could check my sdk and update if needed
but that doesn"t explain how the lua sample can link !! ???
zoret
Posts: 22
Joined: Sun Mar 19, 2006 7:57 pm

Post by zoret »

ok i've just found it !
the lua libs need the lm lib so i have to put this lib at the end of the libs list

i've simply modified my makefile :

LIBS= -lpspgum -lpspgu -lpspusb -lpspusbstor -llualib -llua -lm

the linker is rather dumb...

nevermind, now it works !!
PeterM
Posts: 125
Joined: Sat Dec 31, 2005 7:25 pm
Location: Edinburgh, UK
Contact:

Post by PeterM »

Glad it works now - yes, the fact that order is important in linking really is a pain sometimes.

I wonder if this feature actually has any practical use...
Post Reply