Test Program

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

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
turkeyman
Posts: 75
Joined: Wed Oct 20, 2004 7:38 pm
Location: Brisbane, Australia
Contact:

Test Program

Post by turkeyman »

Hi guys,

I'm trying to port my homebrew engine/games to PSP using the PSPSDK (the windows binary edition thats floating around)

After spending most of today with it, i ported most of it and got it compiling just fine, but i'm having trouble fixing the last few link errors....

Its worth mentioning, i am not using the makefile, and i am not using make (I've written a GCC compiler plugin for VS).. Can anyone perhaps give me a full command line for the link step? (including libs that should/shouldnt be linked)

I know some of the libs are linked implicitly, and are 'hard wired' in by psp-gcc, but i dont know what ones they are, and which libs i have to link manually/etc..

Sorry, i have next to no experience with working with linux/GCC, so if anyone can help me out with these last few errors i'd appreciate it heaps..

They are as follows:
/cygdrive/d/Programming/PSPDev/bin/../lib/gcc/psp/4.0.0/../../../../psp/lib/crt0.o: In function `__entrytable':
crt0.S:(.rodata.sceResident+0xc): undefined reference to `module_info'
D:/Projects/Fuji/Lib/libFuji_Debug_PSP.a(Util.o): In function `dprintf(char const*, ...)':
Util.cpp:(.text+0x248): relocation truncated to fit: R_MIPS_GPREL16 against `_impure_ptr'
D:/programming/pspdev/psp/lib/libc.a(sbrkr.o): In function `_sbrk_r':
../../../../../newlib/libc/reent/sbrkr.c:60: undefined reference to `sbrk'
D:/programming/pspdev/psp/lib/libc.a(makebuf.o): In function `__smakebuf':
../../../../../newlib/libc/stdio/makebuf.c:96: undefined reference to `isatty'
D:/programming/pspdev/psp/lib/libc.a(writer.o): In function `_write_r':
../../../../../newlib/libc/reent/writer.c:58: undefined reference to `write'
D:/programming/pspdev/psp/lib/libc.a(closer.o): In function `_close_r':
../../../../../newlib/libc/reent/closer.c:53: undefined reference to `close'
D:/programming/pspdev/psp/lib/libc.a(fstatr.o): In function `_fstat_r':
../../../../../newlib/libc/reent/fstatr.c:62: undefined reference to `fstat'
D:/programming/pspdev/psp/lib/libc.a(lseekr.o): In function `_lseek_r':
../../../../../newlib/libc/reent/lseekr.c:58: undefined reference to `lseek'
D:/programming/pspdev/psp/lib/libc.a(readr.o): In function `_read_r':
../../../../../newlib/libc/reent/readr.c:58: undefined reference to `read'
D:/programming/pspdev/psp/lib/libm.a(w_sqrt.o): In function `sqrt':
../../../../../newlib/libm/math/w_sqrt.c:83: undefined reference to `__errno'
../../../../../newlib/libm/math/w_sqrt.c:86: undefined reference to `__errno'
D:/programming/pspdev/psp/lib/libm.a(wf_acos.o): In function `acosf':
../../../../../newlib/libm/math/wf_acos.c:50: undefined reference to `__errno'
../../../../../newlib/libm/math/wf_acos.c:47: undefined reference to `__errno'
D:/programming/pspdev/psp/lib/libm.a(wf_sqrt.o): In function `sqrtf':
../../../../../newlib/libm/math/wf_sqrt.c:50: undefined reference to `__errno'
D:/programming/pspdev/psp/lib/libm.a(wf_sqrt.o):../../../../../newlib/libm/math/wf_sqrt.c:53: more undefined references to `__errno' follow
D:/programming/pspdev/psp/lib/libstdc++.a(pure.o):../../../../libstdc++-v3/libsupc++/pure.cc:54: undefined reference to `write'
collect2: ld returned 1 exit status

lots of them reference the __errno symbol.. wheres that sposed to be?
also read/write/close/etc feature in there..
and 'module_info'? is that some GCC thing?

Thanks heaps!
- Turkey
User avatar
turkeyman
Posts: 75
Joined: Wed Oct 20, 2004 7:38 pm
Location: Brisbane, Australia
Contact:

Post by turkeyman »

no ideas?

perhaps i should just define them all myself for the sake of getting it to link :P

thats not what i had in mind tho..
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

Use toolchain.sh to build the latest PSPSDK out of Subversion.
User avatar
turkeyman
Posts: 75
Joined: Wed Oct 20, 2004 7:38 pm
Location: Brisbane, Australia
Contact:

Post by turkeyman »

well i built the latest stuff from svn successfully..
and after a little more tweaking, all link errors are fixed except some references from libc.a

my command line (probably wrong.. do i need all these libs?):

psp-gcc.exe Build/Debug_PSP/*.o ../Fuji/lib/libFuji_Debug_PSP.a -LC:\cygwin\usr\local\pspdev\psp\sdk\lib /usr/local/pspdev/psp/lib/crt0.o -lpspkernel -lpsplibc -lpspglue -lpspuser -lg -lm -liberty -lstdc++ -lsupc++ -lc

do i need to specify crt0.o like that?

and here are the remaining link errors (path's trimmed for readability):

../fuji/lib/libFuji_Debug_PSP.a(Util.o): In function `dprintf(char const*, ...)':
Util.cpp:(.text+0x248): relocation truncated to fit: R_MIPS_GPREL16 against `_impure_ptr'
..../libc.a(makebuf.o): In function `__smakebuf':
/newlib/libc/stdio/makebuf.c:96: undefined reference to `isatty'
..../libc.a(sbrkr.o): In function `_sbrk_r':
/newlib/libc/reent/sbrkr.c:60: undefined reference to `sbrk'
..../libc.a(writer.o): In function `_write_r':
/newlib/libc/reent/writer.c:58: undefined reference to `write'
..../libc.a(closer.o): In function `_close_r':
/newlib/libc/reent/closer.c:53: undefined reference to `close'
..../libc.a(fstatr.o): In function `_fstat_r':
/newlib/libc/reent/fstatr.c:62: undefined reference to `fstat'
..../libc.a(lseekr.o): In function `_lseek_r':
/newlib/libc/reent/lseekr.c:58: undefined reference to `lseek'
..../libc.a(readr.o): In function `_read_r':
/newlib/libc/reent/readr.c:58: undefined reference to `read'
collect2: ld returned 1 exit status

same ones that were there before.. but a few less..

again, i appologise for my ignorance, this GCC stuff is all new to me, and i'm trying to perform all the build steps manually..
User avatar
turkeyman
Posts: 75
Joined: Wed Oct 20, 2004 7:38 pm
Location: Brisbane, Australia
Contact:

Post by turkeyman »

no takers? :(
i've been fiddling with it for 2 days now... its not giving me any love..
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

There's a psptoolchain in Subversion that hasn't been released yet that fixes this problem. You can grab the one from subversion, or wait for it to be released (probably when ooPo reads this message :).

It's just that the psptoolchain on ooPo's site has become out of sync with PSPSDK in subversion.
User avatar
turkeyman
Posts: 75
Joined: Wed Oct 20, 2004 7:38 pm
Location: Brisbane, Australia
Contact:

Post by turkeyman »

i did build the latest toolchain from svn...
so unless i screwed up building it (which i'm fairly sure i didnt) i suspect there may be another problem, or i am just doing something else wrong with the linker..

when you say 'theres *a* psptoolchain in subversion' .. is it like on a branch or something? i used this link:
svn://svn.pspdev.org/psp/trunk/pspsdk

it all built according to plan, and it fixed some of my link errors, but those ones still remain.. :/ .. perhaps i'll try again from scratch.. although i dont really know how to uninstall stuff in linux.. (it'll leave paths to deleted directories and stuff if i just delete it)

thanks anyway.. hopefully he reads this soon ;)
User avatar
Agoln
Posts: 326
Joined: Wed Jun 08, 2005 3:14 am
Location: Fort Wayne, IN

Post by Agoln »

turkeyman wrote:although i dont really know how to uninstall stuff in linux.. (it'll leave paths to deleted directories and stuff if i just delete it)

To delete stuff in linux, just do a:

make clean


There is no registery in linux as there is in windows, so there isn't much left after you just delete the directory. Nothing is left behind.
Lego of my Ago!
User avatar
turkeyman
Posts: 75
Joined: Wed Oct 20, 2004 7:38 pm
Location: Brisbane, Australia
Contact:

Post by turkeyman »

what about dangling paths?

where are all the path's actually stored anyway?
and i'm in cygwin mind you, so does it share windows' path? or whats the story there?
User avatar
Agoln
Posts: 326
Joined: Wed Jun 08, 2005 3:14 am
Location: Fort Wayne, IN

Post by Agoln »

turkeyman wrote:what about dangling paths?

where are all the path's actually stored anyway?
and i'm in cygwin mind you, so does it share windows' path? or whats the story there?
I'm not sure how cygwin deals with windows paths.

If you do a:

Code: Select all

echo $PATH
in cygwin, does it return the same as a:

Code: Select all

echo %path%
in windows?

That would probably give you some more infromation about it.

As for changing variables and path's, check out ~/.bashrc or ~/.bash_profile (~ is home directory), and anything that modifies your path or any variable for that matter is usually right there in those files.
Lego of my Ago!
User avatar
turkeyman
Posts: 75
Joined: Wed Oct 20, 2004 7:38 pm
Location: Brisbane, Australia
Contact:

Post by turkeyman »

mrbrown:

when you refer to the 'psptoolchain' do you mean the compiler? or the sdk+tools? (they are separate at this point arent they?)

how is it possible for the compiler (psp-gcc.exe) to be incompatible with linking a particular lib?

perhaps i dont understand the problem, this GCC environment is still very foreign to me...

how can i build the compilers from svn? i only saw the pspsdk stuff in there...
User avatar
turkeyman
Posts: 75
Joined: Wed Oct 20, 2004 7:38 pm
Location: Brisbane, Australia
Contact:

Post by turkeyman »

ah okay, upon closer inspection, i noticed theres not only the pspsdk in the svn trunk... theres loads of stuff :P

so if i build the toolchain from 'svn://svn.pspdev.org/psp/trunk/psptoolchain' using the toolchain.sh from within the repository, will that build a set of compatible compilers/tools? (big download, takes ages.. want to be sure its what i'm looking for first before i try)

thanks
User avatar
turkeyman
Posts: 75
Joined: Wed Oct 20, 2004 7:38 pm
Location: Brisbane, Australia
Contact:

Post by turkeyman »

and i'm linking!! :)
now i'm in business.. time to cause some damage!

cool thanks heaps guys! :P
XxBAOxX
Posts: 19
Joined: Thu Oct 06, 2005 10:03 am

Post by XxBAOxX »

turkeyman wrote:ah okay, upon closer inspection, i noticed theres not only the pspsdk in the svn trunk... theres loads of stuff :P

so if i build the toolchain from 'svn://svn.pspdev.org/psp/trunk/psptoolchain' using the toolchain.sh from within the repository, will that build a set of compatible compilers/tools? (big download, takes ages.. want to be sure its what i'm looking for first before i try)

thanks
ok...how do i build this toolchain from within the repository?.....


edit-im sorry if this was a stupid question.....i automatically assumed that all i had to do was download the toolchain.sh into my current psptoolchain dir.....so what i meant to ask is if im doing it right?
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

a simple read of the included
README file within the toolchain tarball
would have told you enough information

but just for clarity please input these
into your bash shell while cwd in psptoolchain
directory:

Installation from Subversion

1.) svn co svn://svn.pspdev.org/psp/trunk/pspsdk

(that will checkout current version from svn and
files will be under pspsdk dir complete with all you will need
including docs) :P

Once you've downloaded PSPSDK, run the following from the pspsdk directory
to create the configure script and support files (you must have autoconf and
automake installed):

2.) ./bootstrap

3.) ./configure

4.) make

5.) make doxygen-doc (only if you would like to build pspsdk
documentation and MUST of course have doxygen installed)

6.)finally do a - make install

if you performed these simple commands then
congratulation you have installed the freshest revision
of pspsdk off svn ;)

you wont need to perform these commands everytime
when you need to update from svn

a simple
svn up or svn update while cwd in psptoolchain will do this
for you :)

All i have described is written (coherently) in PSPSDK
README file .... next time do a little research
something as simple as reading those blasted dofagled
new age readme's is all you will need as i have just
demostrated ;)
10011011 00101010 11010111 10001001 10111010
XxBAOxX
Posts: 19
Joined: Thu Oct 06, 2005 10:03 am

Post by XxBAOxX »

thanks buddy....

youve really helped me out alot.....and actually....hold on *takes foot outta mouth* i just read it...lol.....
Post Reply