Questions on porting SDL apps

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

Moderators: cheriff, TyRaNiD

Post Reply
Nimue
Posts: 5
Joined: Sun Oct 19, 2008 4:54 pm

Questions on porting SDL apps

Post by Nimue »

I found the one guide to porting SDL apps using rRootage as an example, however I would like any others available. With some simple ones I've received and attempted to port I've had... Issues. If possible I'd like a general tutorial on writing or modifying the Makefile for porting SDL apps. Impossible to be a catch-all of course, but any tips would be appreciated.

http://i.1asphost.com/Nimue1016/dungeonmaker-2.05.7z

That's the code (slightly modified) with the Makefile I'm using.

I get these errors:

Code: Select all

/tmp/cckBJFNY.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
/usr/local/pspdev/lib/gcc/psp/4.3.1/libgcc.a(unwind-dw2.o): In function `uw_install_context_1':
../../../libgcc/../gcc/unwind-dw2.c:1505: undefined reference to `memcpy'
collect2: ld returned 1 exit status
make: *** [Template.elf] Error 1
User avatar
Wally
Posts: 663
Joined: Mon Sep 26, 2005 11:25 am

Re: Questions on porting SDL apps

Post by Wally »

Nimue wrote:I found the one guide to porting SDL apps using rRootage as an example, however I would like any others available. With some simple ones I've received and attempted to port I've had... Issues. If possible I'd like a general tutorial on writing or modifying the Makefile for porting SDL apps. Impossible to be a catch-all of course, but any tips would be appreciated.

http://i.1asphost.com/Nimue1016/dungeonmaker-2.05.7z

That's the code (slightly modified) with the Makefile I'm using.

I get these errors:

Code: Select all

/tmp/cckBJFNY.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
/usr/local/pspdev/lib/gcc/psp/4.3.1/libgcc.a(unwind-dw2.o): In function `uw_install_context_1':
../../../libgcc/../gcc/unwind-dw2.c:1505: undefined reference to `memcpy'
collect2: ld returned 1 exit status
make: *** [Template.elf] Error 1
You are missing string.h in your includes.

Wally
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Looks more like they're missing libc than the include. The SDL libs have certain library requirements of their own on the PSP. Look at various PSP SDL projects to get an idea of what other libs to include in the makefile.

For example, here's the libs used with Jump 'n Bump -

Code: Select all

LIBS += $(shell $(PSPBIN)/freetype-config --libs)

LIBS += -lSDL_mixer -lvorbisfile -lvorbis -logg

LIBS += -L/usr/local/pspdev/psp/lib -lSDL -lpspirkeyb -lGL -lm -lpspvfpu -L/usr/local/pspdev/psp/sdk/lib -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lpspnet_inet -lpsppower

LIBS += -lSDL_ttf -lfreetype

LIBS += -lpng -ljpeg -lz -lm -lpsppower -lmad -lpspaudio -lpspaudiolib

Nimue
Posts: 5
Joined: Sun Oct 19, 2008 4:54 pm

Post by Nimue »

Well with string.h included I am still having the memcpy error. I have actually been getting this on one or two other things I've tried to port. Any suggestions?
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

-lc
Nimue
Posts: 5
Joined: Sun Oct 19, 2008 4:54 pm

Post by Nimue »

J.F. wrote:-lc
Still no luck and the same error. Even copying and pasting the LIBS section (and then taking out the parts I don't have support for that shouldn't matter [tiff, irkeyboard, etc]) you supplied doesn't seem to help any.

Download the file I supplied and then change the following things:

add #include<string.h> to the DungeonMaker.cpp file

Replace the Makefile with this:

Code: Select all


TARGET = Template
OBJS = DungeonMaker.cpp

CC=gcc
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41;

LIBDIR =

LIBS += -L/usr/local/pspdev/psp/lib -lSDL -lGL -lm -lpspvfpu -L/usr/local/pspdev/psp/sdk/lib -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lpspnet_inet -lpsppower

LIBS += -lpng -ljpeg -lz -lm -lpsppower -lmad -lpspaudio -lpspaudiolib 
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Template

PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build.mak 

Insert_witty_name
Posts: 376
Joined: Wed May 10, 2006 11:31 pm

Post by Insert_witty_name »

I download the archive you linked at the top.

This Makefile compiles the DungeonMaker.cpp file for me.

Code: Select all

TARGET = Template
OBJS = DungeonMaker.o

CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41;

LIBDIR =
LIBS = -lpspgu -lpng -lz -lm -lstdc++
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Template

PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build.mak
Note the subtle differences.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

AH!! It's a C++ project! No wonder -lc wasn't working. :) I wish people would specify C/C++ when asking about problems. Us devs know there's a difference, and it's so fundamental, we might not ask. It would be like asking "well, are you using a computer?" :D
Nimue
Posts: 5
Joined: Sun Oct 19, 2008 4:54 pm

Post by Nimue »

J.F. wrote:AH!! It's a C++ project! No wonder -lc wasn't working. :) I wish people would specify C/C++ when asking about problems. Us devs know there's a difference, and it's so fundamental, we might not ask. It would be like asking "well, are you using a computer?" :D
Eh... I know well enough that there's a rather fundamental difference... I've coded in both (mostly in C), I don't really know -lc, I just use a template Makefile for my varying projects (which have admittedly been rather simple file parsers and such. One short little text game I wrote in C++ as my first project back in like... High school. Also some limited image shit for course purposes down at GATech) I made awhile ago (about three years). I just figured you took a look at the link I posted and just followed what you said. I'm not really a serious developer. Just write what I need.

edit: I just caught that I had CC=gcc. Feel like an idiot there.

Still having issues though. There's a reason it's called a template =P. Used it on my other PSP projects (Again, nothing notable. Just... Displaying text and such).

Code: Select all

/usr/local/pspdev/lib/gcc/psp/4.3.1/../../../../psp/lib/crt0.o&#58; In function `_main'&#58;
/usr/local/src/psptoolchain/build/pspsdk/src/startup/crt0.c&#58;86&#58; undefined reference to `main'
collect2&#58; ld &#12399;&#12473;&#12486;&#12540;&#12479;&#12473; 1 &#12391;&#32066;&#20102;&#12375;&#12414;&#12375;&#12383;
make&#58; *** &#91;Template.elf&#93; &#12456;&#12521;&#12540; 1
Onii
Posts: 40
Joined: Sun Oct 05, 2008 1:07 pm

Post by Onii »

I think you need -lSDL_main.
Nimue
Posts: 5
Joined: Sun Oct 19, 2008 4:54 pm

Post by Nimue »

Onii wrote:I think you need -lSDL_main.
Couldn't seem to find it.
User avatar
Wally
Posts: 663
Joined: Mon Sep 26, 2005 11:25 am

Post by Wally »

Nimue wrote:
Onii wrote:I think you need -lSDL_main.
Couldn't seem to find it.
you'll have to rename the main loop its more commonly known as main(arg c blah blah)

call it main() of course.

Wally
Post Reply