libpspglue issues

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

Moderators: cheriff, TyRaNiD

Post Reply
TommyBear
Posts: 50
Joined: Fri Jun 24, 2005 11:21 pm

libpspglue issues

Post by TommyBear »

Hi Guys,

Currently in ScummVM-PSP we've had to stub off these functions because of the following undefined symbols:

Code: Select all

/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libstdc++.a(pure.o):../.
./../../libstdc++-v3/libsupc++/pure.cc:54: undefined reference to `write'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(sbrkr.o): In func
tion `_sbrk_r':
../../../../../newlib/libc/reent/sbrkr.c:60: undefined reference to `sbrk'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(writer.o): In fun
ction `_write_r':
../../../../../newlib/libc/reent/writer.c:58: undefined reference to `write'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(closer.o): In fun
ction `_close_r':
../../../../../newlib/libc/reent/closer.c:53: undefined reference to `close'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(fstatr.o): In fun
ction `_fstat_r':
../../../../../newlib/libc/reent/fstatr.c:62: undefined reference to `fstat'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(lseekr.o): In fun
ction `_lseek_r':
../../../../../newlib/libc/reent/lseekr.c:58: undefined reference to `lseek'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(readr.o): In func
tion `_read_r':
../../../../../newlib/libc/reent/readr.c:58: undefined reference to `read'
collect2: ld returned 1 exit status
make: *** [scummvm-psp.elf] Error 1
Now I know libpspglue implements these right? Has anyone successfully compiled a c++ file using libstdc++, libpspglue, libpsplibc and libc combined?

Here is the PSPSDK_LIBC_LIB var we are using:

PSPSDK_LIBC_LIB = -lm -lstdc++ -lpsplibc -lpspglue -lc

Tommy.[/code]
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

You're only to use either libpsplibc, or libc + libpspglue. Never both at the same time.
TommyBear
Posts: 50
Joined: Fri Jun 24, 2005 11:21 pm

Post by TommyBear »

mrbrown wrote:You're only to use either libpsplibc, or libc + libpspglue. Never both at the same time.
Well okay but libpsplibc does not implement:
__errorno
_impure_ptr
__assert

I'm using this:
-lm -lstdc++ -lpsplibc

Get this:

Code: Select all

/cygdrive/c/DOCUME~1/THOMAS~1/LOCALS~1/Temp/cc4PTjnp.o: In function `Scumm::ScummEngine_v2::redrawV2Inventory()':
verbs.cpp:(.text+0x4d0): undefined reference to `__assert'
/cygdrive/c/DOCUME~1/THOMAS~1/LOCALS~1/Temp/cc4PTjnp.o: In function `Scumm::ScummEngine::drawVerbBitmap(int, int, int)':
verbs.cpp:(.text+0xee8): undefined reference to `__assert'
verbs.cpp:(.text+0xf08): undefined reference to `__assert'
/cygdrive/c/DOCUME~1/THOMAS~1/LOCALS~1/Temp/cc8VgpXq.o: In function `Scumm::wizPackType1Helper2(unsigned char*&, int, Scumm::wizPackCtx*)':
wiz_he.cpp:(.text+0x5a8): undefined reference to `__assert'
/cygdrive/c/DOCUME~1/THOMAS~1/LOCALS~1/Temp/cc8VgpXq.o: In function `Scumm::Wiz::getWizImageDim(int, int, int&, int&)':
wiz_he.cpp:(.text+0x6c8): undefined reference to `__assert'
/cygdrive/c/DOCUME~1/THOMAS~1/LOCALS~1/Temp/cc8VgpXq.o:wiz_he.cpp:(.text+0x750): more undefined references to `__assert' follow
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libm.a(w_atan2.o): In function `atan2':
../../../../../newlib/libm/math/w_atan2.c:110: undefined reference to `__errno'
../../../../../newlib/libm/math/w_atan2.c:107: undefined reference to `__errno'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libm.a(w_hypot.o): In function `hypot':
../../../../../newlib/libm/math/w_hypot.c:99: undefined reference to `__errno'
../../../../../newlib/libm/math/w_hypot.c:102: undefined reference to `__errno'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libm.a(w_log.o): In function `log':
../../../../../newlib/libm/math/w_log.c:106: undefined reference to `__errno'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libm.a(w_log.o):../../../../../newlib/libm/math/w_log.c:110: more undefined references to `__e
rrno' follow
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libstdc++.a(pure.o):../../../../libstdc++-v3/libsupc++/pure.cc:54: undefined reference to `wri
te'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libstdc++.a(vterminate.o):../../../../libstdc++-v3/libsupc++/vterminate.cc:69: undefined refer
ence to `_impure_ptr'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libstdc++.a(vterminate.o):../../../../libstdc++-v3/libsupc++/vterminate.cc:70: undefined refer
ence to `_impure_ptr'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libstdc++.a(vterminate.o):../../../../libstdc++-v3/libsupc++/vterminate.cc:74: undefined refer
ence to `_impure_ptr'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libstdc++.a(vterminate.o):../../../../libstdc++-v3/libsupc++/vterminate.cc:74: undefined refer
ence to `_impure_ptr'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libstdc++.a(vterminate.o):../../../../libstdc++-v3/libsupc++/vterminate.cc:51: undefined refer
ence to `_impure_ptr'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libstdc++.a(vterminate.o):../../../../libstdc++-v3/libsupc++/vterminate.cc:51: more undefined
references to `_impure_ptr' follow
/usr/local/pspdev/psp/sdk/lib/libpsplibc.a(ftell.o): In function `ftell':
../../../sdk/libc/stdio.c:718: undefined reference to `__errno'
../../../sdk/libc/stdio.c:724: undefined reference to `__errno'
/usr/local/pspdev/psp/sdk/lib/libpsplibc.a(strtol.o): In function `strtol':
../../../sdk/libc/stdlib.c:1034: undefined reference to `__errno'
../../../sdk/libc/stdlib.c:1034: undefined reference to `__errno'
collect2: ld returned 1 exit status
make: *** [scummvm-psp.elf] Error 1
Unless I'm doing something completely whacky... This is why I included libc which implements these. This is using the latest released psptoolchain 625.

Tommy.
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

Well, you should really be using Newlib's libc. Your earlier output indicated you weren't using the latest toolchain, as read, write, sbrk, etc. should have an underscore in front of their names.

So grab the latest toolchain, and if you are manually specifying your libraries use -lc -lpspglue. Preserve the library order in build.mak.
TommyBear
Posts: 50
Joined: Fri Jun 24, 2005 11:21 pm

Post by TommyBear »

Ok will do. Thanks

Tommy.
abszero
Posts: 2
Joined: Wed Jul 06, 2005 12:47 pm

Post by abszero »

I'm basically in the same situation as TommyBear. After switching to newlib I got rid of some errors with _ctype_, _errno, etc, but now it's unable to find a number of functions (open, lseek, read, write, close, stat, fstat, and several others).

mrbrown indicated that if it had been compiled with the most recent toolchain that these functions should be prefixed with underscores, but I'm running today's 20050705 release and that doesn't seem to be the case. That's newer than the one available at the time of that post so things may have reverted or something but I had the same errors at one point with the 0625 version of the toolchain. Any suggestions?

For reference:
psp-gcc -O2 -G0 -fno-strength-reduce -Wall -D"USE_PSP" -L$(PSPSDK)/lib -lpspdebug -lstdc++ -lc -lpspglue -lpspkernel ...

-abszero
Post Reply