| View previous topic :: View next topic |
| Author |
Message |
gambiting
Joined: 17 Aug 2006 Posts: 154
|
Posted: Tue Feb 19, 2008 3:28 am Post subject: Can't compile some SDL + OpenGL stuff ... |
|
|
Hi! I'm working on new game for NeoFlash Spring contest,and I can't compile my very early source :P.I guess I have all needed libs,so I don't know what's the problem.Also,the same source compiles to linux executable without problems.Errors I have are:
| Code: | gambiting@gambiting-desktop:~/psp_opengl$ make
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -fno-exceptions -I/usr/local/pspdev/psp/include/SDL -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -fno-exceptions -I/usr/local/pspdev/psp/include/SDL -fno-rtti -D_PSP_FW_VERSION=371 -c -o main.o main.cpp
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -fno-exceptions -I/usr/local/pspdev/psp/include/SDL -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -fno-exceptions -I/usr/local/pspdev/psp/include/SDL -fno-rtti -D_PSP_FW_VERSION=371 -c -o player.o player.cpp
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -fno-exceptions -I/usr/local/pspdev/psp/include/SDL -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -fno-exceptions -I/usr/local/pspdev/psp/include/SDL -fno-rtti -D_PSP_FW_VERSION=371 -c -o timer.o timer.cpp
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -fno-exceptions -I/usr/local/pspdev/psp/include/SDL -D_PSP_FW_VERSION=371 -L. -L/usr/local/pspdev/psp/sdk/lib -specs=/usr/local/pspdev/psp/sdk/lib/prxspecs -Wl,-q,-T/usr/local/pspdev/psp/sdk/lib/linkfile.prx main.o player.o timer.o /usr/local/pspdev/psp/sdk/lib/prxexports.o -L/usr/local/pspdev/psp/lib -lSDL_ttf -lSDL -lSDL_gfx -lGL -lGLU -lm -lpspvfpu -L/usr/local/pspdev/psp/lib -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lpsppower -lfreetype -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o tankswar.psp.elf
main.o: In function `__static_initialization_and_destruction_0(int, int)':
main.cpp:(.text+0x7c): undefined reference to `std::ios_base::Init::Init()'
main.cpp:(.text+0x84): undefined reference to `std::ios_base::Init::~Init()'
/usr/local/pspdev/psp/lib/libGLU.a(gluPerspectivef.o): In function `gluPerspectivef':
/home/gambiting/psp/pspgl/gluPerspectivef.c:30: undefined reference to `glMultMatrixf'
collect2: ld returned 1 exit status
make: *** [tankswar.psp.elf] Error 1
gambiting@gambiting-desktop:~/psp_opengl$ | Please help. |
|
| Back to top |
|
 |
gambiting
Joined: 17 Aug 2006 Posts: 154
|
Posted: Tue Feb 19, 2008 3:57 am Post subject: |
|
|
Ok,I repaired it - I removed glMultMatrixf from libriary source,and removed #include <iostream> from main.cpp - it wasn't needed.
But now I have much bigger problem - I want to run it through PSPLink,and all I get is:
| Code: | host0:/> ./tankswar.psp.prx
Load/Start host0:/tankswar.psp.prx UID: 0x0427E067 Name: "Tanks_war"
host0:/> Exception - Bus error (data)
Thread ID - 0x0425E673
Th Name - user_main
Module ID - 0x0427E067
Mod Name - "Tanks_war"
EPC - 0x08806744
Cause - 0x1000001C
BadVAddr - 0x40A00436
Status - 0x20088613
zr:0x00000000 at:0x2008FF00 v0:0x00FFFFFF v1:0x00001D01
a0:0x00000140 a1:0x00000050 a2:0x00000001 a3:0x00010000
t0:0x00000008 t1:0x882F9100 t2:0x00000000 t3:0x088621A0
t4:0x09FBFCD0 t5:0x00001E04 t6:0x0880EE54 t7:0x20088600
s0:0x00000001 s1:0x09FBFE34 s2:0x09FBFE30 s3:0x09FBFEE0
s4:0x00000018 s5:0x00000013 s6:0xDEADBEEF s7:0xDEADBEEF
t8:0x800201AB t9:0x00000000 k0:0x09FBFF00 k1:0x00000000
gp:0x08854CA0 sp:0x09FBFD58 fp:0x09FBFEA0 ra:0x08804388
0x08806744: 0x8C830008 '....' - lw $v1, 8($a0) |
Also,I can see a cursor on a black screen,so I guess that at last SDL inits properly.When I start it from XMB it just hangs.Any ideas please?
I guess it's memory overflow,but this code at this stage ir VERY simple,and also I have build_prx=1 and PSP_HEAP_SIZE_MAX(); set. |
|
| Back to top |
|
 |
gambiting
Joined: 17 Aug 2006 Posts: 154
|
Posted: Tue Feb 19, 2008 4:35 am Post subject: |
|
|
| <double post,sorry> |
|
| Back to top |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
Posted: Tue Feb 19, 2008 6:09 am Post subject: |
|
|
| Try PSP_HEAP_SIZE_KB(20480) instead of PSP_HEAP_SIZE_MAX(). |
|
| Back to top |
|
 |
gambiting
Joined: 17 Aug 2006 Posts: 154
|
Posted: Tue Feb 19, 2008 7:08 am Post subject: |
|
|
| Insert_witty_name wrote: | | Try PSP_HEAP_SIZE_KB(20480) instead of PSP_HEAP_SIZE_MAX(). | Still the same error. |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Tue Feb 19, 2008 9:41 am Post subject: |
|
|
| Well, you can either use the gdb for PSP in the sdk, or you can add prints to the screen (part of the debug code in the sdk). The print method is probably more popular, even on PCs. If you look through most programs, you'll find status prints all over. You'll find examples of using those debug prints in most PSP apps. It's pretty simple and works well enough for most devs. |
|
| Back to top |
|
 |
gambiting
Joined: 17 Aug 2006 Posts: 154
|
Posted: Wed Feb 20, 2008 2:58 am Post subject: |
|
|
| J.F. wrote: | | Well, you can either use the gdb for PSP in the sdk, or you can add prints to the screen (part of the debug code in the sdk). The print method is probably more popular, even on PCs. If you look through most programs, you'll find status prints all over. You'll find examples of using those debug prints in most PSP apps. It's pretty simple and works well enough for most devs. |
Gdb debug gives:
| Code: | (gdb) continue
Continuing.
[New thread 69690211]
Program received signal SIGBUS, Bus error.
[Switching to thread 69690211]
0x08806744 in ?? ()
(gdb) |
I will try to figure out where it hangs with some debug output.I will write when I solve it. |
|
| Back to top |
|
 |
gambiting
Joined: 17 Aug 2006 Posts: 154
|
Posted: Wed Feb 20, 2008 4:18 am Post subject: |
|
|
Ok,I figured out what's the problem,I made a debug statements like that:
| Code: | bool init_all()
{
pspDebugScreenInit();
//Initialize SDL
if( SDL_Init(SDL_INIT_VIDEO) < 0 )
{
return false;
}
printf("\t SDL_INIT Done!\n");
if( SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_OPENGL) == NULL )
{
return false;
}
printf("\t SDL_setVideoMode Done!\n");
//Initialize OpenGL
if( init_GL() == false )
{
return false;
}
printf("\t initGL Done!\n");
return true;
} |
And,inside init_GL function:
| Code: | bool init_GL()
{
//Set clear color
printf("\t initializing ....\n");
glShadeModel(GL_SMOOTH);
printf("\t shade model Done!\n");
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
printf("\t clear color Done!\n");
glClearDepth(1.0f);
printf("\t clear depth!\n");
glEnable(GL_DEPTH_TEST);
printf("\t gl_depth_test Done!\n");
glDepthFunc(GL_LEQUAL);
printf("\t depth func Done!\n");
glMatrixMode( GL_PROJECTION );
printf("\t matrix mode Done!\n");
glLoadIdentity();
printf("\t load identity Done!\n");
gluPerspective(54.0f,(GLfloat)SCREEN_WIDTH/(GLfloat)SCREEN_HEIGHT,1.0f,1000.0f);
printf("\t perspective Done!\n");
glMatrixMode( GL_MODELVIEW );
printf("\t model view2 Done!\n");
glLoadIdentity();
printf("\t load identity 2 Done!\n");
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
printf("\t set atributes Done!\n");
//glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
if( glGetError() != GL_NO_ERROR )
{
return false;
}
return true;
} | When I run it on PSP now,I can see:
| Code: | SDL_INIT Done!
SDL_setVideoMode Done!
initializing.... |
and then it hangs.So now I know that every simple OpenGl instruction will hang it - now the question is - why??? I thought that opengl is working fine on slim?? |
|
| Back to top |
|
 |
gambiting
Joined: 17 Aug 2006 Posts: 154
|
Posted: Wed Feb 20, 2008 4:47 am Post subject: |
|
|
Ok,I found on the other thread that I have to recompile SDL with sdl support( -DHAVE_OPENGL cflag set),so I did.Now it won't compile with such errors:
| Code: | gambiting@gambiting-desktop:~/psp_opengl$ make
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -g -O2 -G0 -Wall -fno-exceptions -I/usr/local/pspdev/psp/include/SDL -I. -I/usr/local/pspdev/psp/sdk/include -g -O2 -G0 -Wall -fno-exceptions -I/usr/local/pspdev/psp/include/SDL -fno-rtti -D_PSP_FW_VERSION=371 -c -o main.o main.cpp
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -g -O2 -G0 -Wall -fno-exceptions -I/usr/local/pspdev/psp/include/SDL -I. -I/usr/local/pspdev/psp/sdk/include -g -O2 -G0 -Wall -fno-exceptions -I/usr/local/pspdev/psp/include/SDL -fno-rtti -D_PSP_FW_VERSION=371 -c -o player.o player.cpp
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -g -O2 -G0 -Wall -fno-exceptions -I/usr/local/pspdev/psp/include/SDL -I. -I/usr/local/pspdev/psp/sdk/include -g -O2 -G0 -Wall -fno-exceptions -I/usr/local/pspdev/psp/include/SDL -fno-rtti -D_PSP_FW_VERSION=371 -c -o timer.o timer.cpp
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -g -O2 -G0 -Wall -fno-exceptions -I/usr/local/pspdev/psp/include/SDL -D_PSP_FW_VERSION=371 -L. -L/usr/local/pspdev/psp/sdk/lib -specs=/usr/local/pspdev/psp/sdk/lib/prxspecs -Wl,-q,-T/usr/local/pspdev/psp/sdk/lib/linkfile.prx main.o player.o timer.o /usr/local/pspdev/psp/sdk/lib/prxexports.o -L/usr/local/pspdev/psp/lib -lglut -lGLU -lGL -lSDL_ttf -lSDL -lSDL_gfx -lm -lpspvfpu -lpspdisplay -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lpsppower -lfreetype -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o tankswar.psp.elf
/usr/local/pspdev/psp/lib/libSDL.a(SDL_pspgl.o): In function `PSP_GL_Init':
/home/gambiting/psp/SDL/src/video/psp/SDL_pspgl.c:109: undefined reference to `eglGetDisplay'
/home/gambiting/psp/SDL/src/video/psp/SDL_pspgl.c:109: undefined reference to `eglGetError'
/home/gambiting/psp/SDL/src/video/psp/SDL_pspgl.c:110: undefined reference to `eglInitialize'
/home/gambiting/psp/SDL/src/video/psp/SDL_pspgl.c:110: undefined reference to `eglGetError'
/home/gambiting/psp/SDL/src/video/psp/SDL_pspgl.c:135: undefined reference to `eglChooseConfig'
/home/gambiting/psp/SDL/src/video/psp/SDL_pspgl.c:135: undefined reference to `eglGetError'
/home/gambiting/psp/SDL/src/video/psp/SDL_pspgl.c:143: undefined reference to `eglCreateContext'
/home/gambiting/psp/SDL/src/video/psp/SDL_pspgl.c:143: undefined reference to `eglGetError'
/home/gambiting/psp/SDL/src/video/psp/SDL_pspgl.c:144: undefined reference to `eglCreateWindowSurface'
/home/gambiting/psp/SDL/src/video/psp/SDL_pspgl.c:144: undefined reference to `eglGetError'
/usr/local/pspdev/psp/lib/libSDL.a(SDL_pspgl.o): In function `PSP_GL_SwapBuffers':
/home/gambiting/psp/SDL/src/video/psp/SDL_pspgl.c:82: undefined reference to `eglSwapBuffers'
/usr/local/pspdev/psp/lib/libSDL.a(SDL_pspgl.o): In function `PSP_GL_MakeCurrent':
/home/gambiting/psp/SDL/src/video/psp/SDL_pspgl.c:69: undefined reference to `eglMakeCurrent'
/usr/local/pspdev/psp/lib/libSDL.a(SDL_pspgl.o):(.rodata+0x14): undefined reference to `glBlendFunc'
/usr/local/pspdev/psp/lib/libSDL.a(SDL_pspgl.o):(.rodata+0x44): undefined reference to `glFlush'
/usr/local/pspdev/psp/lib/libSDL.a(SDL_pspgl.o):(.rodata+0x4c): undefined reference to `glGenTextures'
/usr/local/pspdev/psp/lib/libSDL.a(SDL_pspgl.o):(.rodata+0x54): undefined reference to `glGetString'
/usr/local/pspdev/psp/lib/libSDL.a(SDL_pspgl.o):(.rodata+0x6c): undefined reference to `glOrtho'
/usr/local/pspdev/psp/lib/libSDL.a(SDL_pspgl.o):(.rodata+0x74): undefined reference to `glPixelStorei'
/usr/local/pspdev/psp/lib/libSDL.a(SDL_pspgl.o):(.rodata+0x84): undefined reference to `glPopClientAttrib'
/usr/local/pspdev/psp/lib/libSDL.a(SDL_pspgl.o):(.rodata+0x9c): undefined reference to `glPushClientAttrib'
/usr/local/pspdev/psp/lib/libSDL.a(SDL_pspgl.o):(.rodata+0xac): undefined reference to `glTexCoord2f'
/usr/local/pspdev/psp/lib/libSDL.a(SDL_pspgl.o):(.rodata+0xb4): undefined reference to `glTexEnvf'
/usr/local/pspdev/psp/lib/libSDL.a(SDL_pspgl.o):(.rodata+0xc4): undefined reference to `glTexParameteri'
/usr/local/pspdev/psp/lib/libSDL.a(SDL_pspgl.o):(.rodata+0xcc): undefined reference to `glTexSubImage2D'
/usr/local/pspdev/psp/lib/libSDL.a(SDL_pspgl.o):(.rodata+0xd4): undefined reference to `glVertex2i'
collect2: ld returned 1 exit status
make: *** [tankswar.psp.elf] Error 1
gambiting@gambiting-desktop:~/psp_opengl$ |
My makefile looks like this:
| Code: | PSPSDK=$(shell psp-config --pspsdk-path)
PSPDIR=$(shell psp-config --psp-prefix)
SDLCFLAGS=-I/usr/local/pspdev/psp/include/SDL
SDLLIBS=-L/usr/local/pspdev/psp/lib -lglut -lGLU -lGL -lSDL_ttf -lSDL -lSDL_gfx -lm -lpspvfpu -lpspdisplay -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lpsppower -lfreetype
TARGET = tankswar.psp
OBJS = main.o player.o timer.o
CFLAGS = -g -O2 -G0 -Wall -fno-exceptions $(SDLCFLAGS)
CXXFLAGS = $(CFLAGS) -fno-rtti
ASFLAGS = $(CFLAGS)
BUILD_PRX = 1
PSP_FW_VERSION = 371
LIBS = $(SDLLIBS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Tanks War
include $(PSPSDK)/lib/build.mak | PLEASE help! |
|
| Back to top |
|
 |
danzel
Joined: 04 Nov 2005 Posts: 182
|
Posted: Wed Feb 20, 2008 6:11 am Post subject: |
|
|
Change the link order of your libraries, the LIBS line for DSP looks like:
LIBS= -lSDL_image -lSDL_mixer -lSDL -lGLU -lGL -lpng -ljpeg -lz -lm -lstdc++ -lc -lc -lpsputility -lpspdebug -lpspgu -lpspge -lpspdisplay -lpspctrl -lpspvfpu -lpspuser -lpsprtc -lpsppower -lpspdebug -lpspge -lpspaudio -lpspctrl -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpsphprm -lpspsdk
DSP doesn't use freetype, slide that in around -lpng I think (assuming you are using it). |
|
| Back to top |
|
 |
gambiting
Joined: 17 Aug 2006 Posts: 154
|
Posted: Wed Feb 20, 2008 6:35 am Post subject: |
|
|
Danzel,you are my god,aside Tyranid(and naturally Dark AleX).I've been working whole day to make it run,and it was that simple! Genius,genius I say...
Here's my makefile now If anyone wants it:
| Code: | PSPSDK=$(shell psp-config --pspsdk-path)
PSPDIR=$(shell psp-config --psp-prefix)
SDLCFLAGS=-I/usr/local/pspdev/psp/include/SDL
LIBS= -lSDL -lGLU -lGL -lz -lm -lstdc++ -lc -lc -lpsputility -lpspdebug -lpspgu -lpspge -lpspdisplay -lpspctrl -lpspvfpu -lpspuser -lpsprtc -lpsppower -lpspdebug -lpspge -lpspaudio -lpspctrl -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpsphprm -lpspsdk
TARGET = tankswar.psp
OBJS = main.o player.o timer.o
CFLAGS = -g -O2 -G0 -Wall -fno-exceptions -DHAVE_OPENGL $(SDLCFLAGS)
CXXFLAGS = $(CFLAGS) -fno-rtti
ASFLAGS = $(CFLAGS)
BUILD_PRX = 1
PSP_FW_VERSION = 371
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Tanks War
include $(PSPSDK)/lib/build.mak |
|
|
| Back to top |
|
 |
harrysound
Joined: 18 Oct 2008 Posts: 1
|
Posted: Sat Oct 18, 2008 12:27 am Post subject: |
|
|
Hi
Thanks to gambiting i succeeded to compile my first application that uses SDL and OpenGL !
Actually i had to add the following libs to build correctly : -lpspirkeyb -lpspkernel -lpsppower
Does anybody else needed to add these libs to build a SDL/GL app ?
cheers
Harry |
|
| Back to top |
|
 |
Wally

Joined: 26 Sep 2005 Posts: 672
|
Posted: Sat Oct 18, 2008 3:44 am Post subject: |
|
|
| harrysound wrote: | Hi
Thanks to gambiting i succeeded to compile my first application that uses SDL and OpenGL !
Actually i had to add the following libs to build correctly : -lpspirkeyb -lpspkernel -lpsppower
Does anybody else needed to add these libs to build a SDL/GL app ?
cheers
Harry |
It all depends on what the game links to / requires. Im pretty sure a lot of the newer kernel games require these libs installed.
Wally |
|
| Back to top |
|
 |
|