forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

OSK Libraries
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Producted



Joined: 04 Jun 2009
Posts: 56

PostPosted: Thu Jun 04, 2009 12:22 am    Post subject: OSK Libraries Reply with quote

Hello,

I'm trying to get Danzeff's OSK to work. However, compiling the script does not seem to work (make command). Most of the errors were saying something like "png_bytep_null undeclared" (x undeclared, implicit declaration of x etc etc). I think that the problem is; I don't have the correct libraries (yet).

Does anyone wants to RAR all the libraries which are needed for Danzeff's OSK? I know that they are in the SVN but RAR'ing them makes my life a lot easier.

Thanks already.

:)

EDIT: If anyone could also supply me with a working makefile, I would be even happier!
_________________
Producted.net
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Thu Jun 04, 2009 5:35 am    Post subject: Reply with quote

Basilisk II for the PSP is a working example of using Danzeff's OSK in a program. You'll find all the files as well as how to use them in the B2 source.

http://groups.google.com/group/chilly-willys-ice-flow/web/basilisk-ii-for-the-psp?hl=en
Back to top
View user's profile Send private message AIM Address
Producted



Joined: 04 Jun 2009
Posts: 56

PostPosted: Thu Jun 04, 2009 10:28 pm    Post subject: Reply with quote

Thanks J.F. I'll walk my way through the source code of Basilisk II. I'll give a yell if I encounter any other problems.
_________________
Producted.net
Back to top
View user's profile Send private message
Producted



Joined: 04 Jun 2009
Posts: 56

PostPosted: Thu Jun 04, 2009 11:54 pm    Post subject: Reply with quote

Hm, that project (Basilisk) is just huge. I don't even know what I should copy and what not (if the libraries are even there).

Anyone mind telling me?
_________________
Producted.net
Back to top
View user's profile Send private message
Producted



Joined: 04 Jun 2009
Posts: 56

PostPosted: Fri Jun 05, 2009 12:24 am    Post subject: Reply with quote

I used the PSPDevLibInstaller and now everything is fucked. :p
A lot of undefined references. Argh.
_________________
Producted.net
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Fri Jun 05, 2009 4:29 am    Post subject: Reply with quote

Danzeff is setup in main_psp.cpp at line 498. The rest is in video_psp.cpp at line 1505 and 1535.
Back to top
View user's profile Send private message AIM Address
Producted



Joined: 04 Jun 2009
Posts: 56

PostPosted: Fri Jun 05, 2009 10:51 pm    Post subject: Reply with quote

It's not the OSK code which isn't working, it are the libraries;

Quote:

C:\pspdev\projects\GPOS>make
psp-gcc -I. -IC:/pspdev/psp/sdk/include -O2 -G0 -Wall -L. -LC:/pspdev/psp/sdk/l
ib danzeff.o main.o -lpspgu -ld -o hello.elf
/cygdrive/c/pspdev/bin/../lib/gcc/psp/4.0.2/../../../../psp/bin/ld: cannot find
-ld
collect2: ld returned 1 exit status
make: *** [hello.elf] Error 1


The compiler can't find them (don't tell me that I'm missing the png and other libs, I'm aware of that, just removed them for testing purposes).
_________________
Producted.net
Back to top
View user's profile Send private message
Producted



Joined: 04 Jun 2009
Posts: 56

PostPosted: Sat Jun 06, 2009 4:01 am    Post subject: Reply with quote

Anyone?!
_________________
Producted.net
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat Jun 06, 2009 5:05 am    Post subject: Reply with quote

You have -ld in the makefile somewhere - which tells it to link the libd library... which it can't find.
Back to top
View user's profile Send private message AIM Address
Producted



Joined: 04 Jun 2009
Posts: 56

PostPosted: Sun Jun 07, 2009 11:54 pm    Post subject: Reply with quote

Still not able to get it to work. :(
A lot of undefined references (to sceKernelblabla etc). What am I doing wrong?
_________________
Producted.net
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Mon Jun 08, 2009 4:39 am    Post subject: Reply with quote

Link in the libraries that have the functions it says are undefined.
Back to top
View user's profile Send private message AIM Address
Producted



Joined: 04 Jun 2009
Posts: 56

PostPosted: Mon Jun 08, 2009 10:19 pm    Post subject: Reply with quote

LIBS = -lstdc++ -lpsprtc -lpspwlan -lpspgum -lpspgu -lpspaudio -lm -lpsppower

Quote:

C:\pspdev\projects\GPOS>make
psp-gcc -I. -IC:/pspdev/psp/sdk/include -O2 -G0 -Wall -L. -LC:/pspdev/psp/sdk/l
ib danzeff.o main.o -lstdc++ -lpsprtc -lpspwlan -lpspgum -lpspgu -lpspaudio -l
m -lpsppower -o hello.elf
/cygdrive/c/pspdev/bin/../lib/gcc/psp/4.0.2/../../../../psp/lib/crt0.o: In funct
ion `_main':
/home/loser/newtoolchain/pspsdk/src/startup/crt0.c:68: undefined reference to `s
trlen'
/home/loser/newtoolchain/pspsdk/src/startup/crt0.c:83: undefined reference to `a
texit'
/home/loser/newtoolchain/pspsdk/src/startup/crt0.c:89: undefined reference to `e
xit'
/cygdrive/c/pspdev/bin/../lib/gcc/psp/4.0.2/../../../../psp/lib/crt0.o: In funct
ion `_start':
/home/loser/newtoolchain/pspsdk/src/startup/crt0.c:149: undefined reference to `
sceKernelCreateThread'
/home/loser/newtoolchain/pspsdk/src/startup/crt0.c:150: undefined reference to `
sceKernelStartThread'
main.o: In function `exit_callback':
main.c:(.text+0x8): undefined reference to `sceKernelExitGame'
main.o: In function `CallbackThread':
main.c:(.text+0x38): undefined reference to `sceKernelCreateCallback'
main.c:(.text+0x40): undefined reference to `sceKernelRegisterExitCallback'
main.c:(.text+0x48): undefined reference to `sceKernelSleepThreadCB'
main.o: In function `SetupCallbacks':
main.c:(.text+0x88): undefined reference to `sceKernelCreateThread'
main.c:(.text+0xa4): undefined reference to `sceKernelStartThread'
main.o: In function `substr':
main.c:(.text+0xc8): undefined reference to `strncat'
main.o: In function `main':
main.c:(.text+0xe4): undefined reference to `pspDebugScreenInit'
main.c:(.text+0xf4): undefined reference to `danzeff_load'
main.c:(.text+0x134): undefined reference to `pspDebugScreenPrintf'
main.c:(.text+0x140): undefined reference to `sceKernelDelayThread'
main.c:(.text+0x150): undefined reference to `sceKernelSleepThread'
main.c:(.text+0x178): undefined reference to `danzeff_render'
collect2: ld returned 1 exit status
make: *** [hello.elf] Error 1


What am I doing wrong? :s

EDIT:
#include <pspkernel.h>
#include <pspdebug.h>
#include <string.h>
#include <stdio.h>
#include "danzeff.h"
_________________
Producted.net
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Tue Jun 09, 2009 4:35 am    Post subject: Reply with quote

From the error message, it doesn't look like a normal PSPSDK makefile... show your makefile here. Again, for reference, look at the makefile in the B2 src/PSP directory (not the original makefile).
Back to top
View user's profile Send private message AIM Address
Producted



Joined: 04 Jun 2009
Posts: 56

PostPosted: Tue Jun 09, 2009 10:56 pm    Post subject: Reply with quote

Quote:

TARGET = GPOS
OBJS = main.o danzeff.o

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

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = GPOS

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak

LIBS = -lpspgu
LIBDIR = $(PSPDEV)/SDK/lib



:(
_________________
Producted.net
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Wed Jun 10, 2009 5:44 am    Post subject: Reply with quote

Okay, the LIBDIR line was in B2 only because B2 used a library from D_A's SDK. If you are using D_A's SDK, you don't need to specify that. Also, your LIBS = line is a bit slim... what happened to all the other libs you specified in the post previously? If it's C++, you need to specify stdc++ at least. Also, moves the LIBS ad LIBDIR lines above the EXTRA_TARGETS line. I'm not sure the position makes a difference, but I'm not sure it works if it's after the include line since then neither are defined when the included file is included.
Back to top
View user's profile Send private message AIM Address
Producted



Joined: 04 Jun 2009
Posts: 56

PostPosted: Thu Jun 11, 2009 12:27 am    Post subject: Reply with quote

Thanks alot J.F, I'm close now.

New makefile:

Quote:

TARGET = GPOS
OBJS = danzeff.o main.o

LIBS = -lstdc++ -lpsprtc -lpspwlan -lpspgum -lpspgu -lpspaudio -lm -lpsppower
LIBDIR = $(PSPDEV)/SDK/lib

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

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = GPOS

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak


New console output:
Quote:

C:\pspdev\projects\GPOS>make
psp-gcc -I. -IC:/pspdev/psp/sdk/include -O2 -G0 -Wall -LC:/pspdev/SDK/lib -L. -
LC:/pspdev/psp/sdk/lib danzeff.o main.o -lstdc++ -lpsprtc -lpspwlan -lpspgum -
lpspgu -lpspaudio -lm -lpsppower -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpsp
sdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lp
spuser -lpspkernel -o GPOS.elf
main.o: In function `main':
main.c:(.text+0xf4): undefined reference to `danzeff_load'
main.c:(.text+0x178): undefined reference to `danzeff_render'
collect2: ld returned 1 exit status
make: *** [GPOS.elf] Error 1


And yes, I did included the danzeff.h file at the start of main.c.

Any suggestions?
_________________
Producted.net
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Thu Jun 11, 2009 5:10 am    Post subject: Reply with quote

Switch main.o and danzeff.o. The link order of object files is as important as the link order of libraries. I think that should do it. There's just a little bit of an art to making these things, but you seem to be catching on quickly. :)
Back to top
View user's profile Send private message AIM Address
Producted



Joined: 04 Jun 2009
Posts: 56

PostPosted: Thu Jun 11, 2009 3:21 pm    Post subject: Reply with quote

Too bad... Even after switching those two (like OBJS = main.o danzeff.o), I'm still getting the same console output as before.
Any other suggestions?
_________________
Producted.net
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Thu Jun 11, 2009 5:25 pm    Post subject: Reply with quote

Producted wrote:
Too bad... Even after switching those two (like OBJS = main.o danzeff.o), I'm still getting the same console output as before.
Any other suggestions?


Make sure you have the function names correct. Capitalization counts. :)
Back to top
View user's profile Send private message AIM Address
Producted



Joined: 04 Jun 2009
Posts: 56

PostPosted: Thu Jun 11, 2009 11:09 pm    Post subject: Reply with quote

Nah, that isn't the problem.

Code:

int main()
{

   pspDebugScreenInit();
   SetupCallbacks();

   danzeff_load();
   if(danzeff_isinitialized())
   {

      danzeff_render();
   
   }

   // Other stuff here

   sceKernelSleepThread();

   return 0;
}

_________________
Producted.net
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Fri Jun 12, 2009 6:08 am    Post subject: Reply with quote

Make sure your danzeff.h has this in it near the top

Code:
#ifdef __cplusplus
extern "C" {
#endif


I know I've had to add that to other PSP includes, I just don't remember if danzeff.h had that originally.
Back to top
View user's profile Send private message AIM Address
Producted



Joined: 04 Jun 2009
Posts: 56

PostPosted: Fri Jun 12, 2009 10:49 pm    Post subject: Reply with quote

Danzeff.h was already containing those lines by default. :p
Any other things I need to add / modify? (or suggestions)
_________________
Producted.net
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat Jun 13, 2009 5:39 am    Post subject: Reply with quote

How about your latest makefile and the full output of the compiler?
Back to top
View user's profile Send private message AIM Address
Producted



Joined: 04 Jun 2009
Posts: 56

PostPosted: Sun Jun 21, 2009 3:06 am    Post subject: Reply with quote

Sorry for the late reply, but I was busy with school and such stuff.

Anyway, latest makefile:
Quote:

TARGET = GPOS
OBJS = main.o danzeff.o

LIBS = -lstdc++ -lpsprtc -lpspwlan -lpspgum -lpspgu -lpspaudio -lm -lpsppower
LIBDIR = $(PSPDEV)/SDK/lib

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

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = GPOS

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak


Full output of the compiler:
Quote:

C:\pspdev\projects\GPOS>make
psp-gcc -I. -IC:/pspdev/psp/sdk/include -O2 -G0 -Wall -LC:/pspdev/SDK/lib -L. -
LC:/pspdev/psp/sdk/lib main.o danzeff.o -lstdc++ -lpsprtc -lpspwlan -lpspgum -
lpspgu -lpspaudio -lm -lpsppower -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpsp
sdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lp
spuser -lpspkernel -o GPOS.elf
main.o: In function `main':
main.c:(.text+0xf4): undefined reference to `danzeff_load'
main.c:(.text+0x178): undefined reference to `danzeff_render'
collect2: ld returned 1 exit status
make: *** [GPOS.elf] Error 1


(:
_________________
Producted.net
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sun Jun 21, 2009 6:52 am    Post subject: Reply with quote

Did you just change the danzeff.c to cpp? If so you'll need to add extern "C" {} around the functions themselves or the names will be mangled.
Back to top
View user's profile Send private message AIM Address
Producted



Joined: 04 Jun 2009
Posts: 56

PostPosted: Mon Jun 22, 2009 2:18 am    Post subject: Reply with quote

^
I don't exactly get where you are pointing at. If you are talking about those extern lines, danzeff.h was already containing them by default. And I didn't changed the extension .c to .cpp.
I'll try that but I don't think it's going to work...

EDIT: Nope :(
_________________
Producted.net
Back to top
View user's profile Send private message
kralyk



Joined: 06 Apr 2008
Posts: 114
Location: Czech Republic, central EU

PostPosted: Mon Jun 22, 2009 2:36 am    Post subject: Reply with quote

What firmware are you building for anyway?
Maybe adding these lines to your makefile could help...

Code:
BUILD_PRX = 1
PSP_FW_VERSION = xxx (enter yours)

_________________
...sorry for my english...
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Mon Jun 22, 2009 7:27 am    Post subject: Reply with quote

Producted wrote:
^
I don't exactly get where you are pointing at. If you are talking about those extern lines, danzeff.h was already containing them by default. And I didn't changed the extension .c to .cpp.
I'll try that but I don't think it's going to work...

EDIT: Nope :(


You NEED danzeff to be C code. It needs to be .c and compiled by gcc, or it needs the extern "C" {} and be compiled by g++. If you don't understand C++ name mangling (which is almost certainly the problem here), then you should post more of the code so we can see where it's wrong. As it is, we're guessing based of a couple error lines and your assertions that you're doing it right.

Look at how it's used in Basilisk II - look at how the filenames are done, look at what is enclosed in extern "C" {}, look at how it's compiled.
Back to top
View user's profile Send private message AIM Address
slasher2661996



Joined: 22 Feb 2009
Posts: 91
Location: Melbourne Australia ZOMG

PostPosted: Mon Jun 22, 2009 8:09 am    Post subject: Reply with quote

Define a prototype for the functions
Back to top
View user's profile Send private message
Producted



Joined: 04 Jun 2009
Posts: 56

PostPosted: Mon Jun 22, 2009 9:21 pm    Post subject: Reply with quote

I do have all the correct extensions, danzeff.c is containing these lines:
Quote:

#ifndef INCLUDED_KEYBOARDS_DANZEFF_H
#define INCLUDED_KEYBOARDS_DANZEFF_H

//danzeff is BSD licensed, if you do make a new renderer then please share it back and I can add it
//to the original distribution.

//Set which renderer target to build for
/* #define DANZEFF_SDL */
/* #define DANZEFF_SCEGU */


//the SDL implementation needs the pspctrl_emu wrapper to convert
//a SDL_Joystick into a SceCtrlData
#ifdef DANZEFF_SDL
#include "pspctrl_emu.h"
#else //not DANZEFF_SDL
#include <pspctrl.h>
#endif //DANZEFF_SDL


#ifdef __cplusplus
extern "C" {
#endif


[..]

#ifdef __cplusplus
}
#endif

#endif //INCLUDED_KEYBOARDS_DANZEFF_H


The filenames in Basilisk II\src\PSP\Danzeff are the same as the extensions of my danzeff files. My makefile is almost the same as Basillisk's makefile (except from the stuff I won't need).

I tried the thing which kralyk said, with no result (I don't see why it would work anyway, BUILD_PRX means that I'm working on a PRX which I'm not (right?))

Slasher could you explain what "defining a prototype for the functions" means?

What did I forgot?
_________________
Producted.net
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group