strange behavior when using psp-g++ without -fno-exceptions
strange behavior when using psp-g++ without -fno-exceptions
what you guys has done to this flag? without this flag we can't find many symbols! but it's not the original purpose for this flags in g++.
Code:
#include <pspstdio.h>
#include <pspkernel.h>
#include <pspuser.h>
PSP_MODULE_INFO("Zhen Han Zi", 0x1000, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
main()
{
}
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -D_PSP_FW_VERSION=150 -G0 -Wall -O2 -L. -L/usr/local/pspdev/psp/sdk/lib t.cpp -lc -lpspgu -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o ZombieStation.elf
t.cpp:8: warning: ISO C++ forbids declaration of 'main' with no type
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_write.o): In function `_write':
../../../../../../newlib/libc/sys/psp/libcglue.c:308: undefined reference to `sceIoWrite'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_nonblocking_write':
../../../../../../newlib/libc/sys/psp/pipe.c:258: undefined reference to `sceKernelTrySendMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_write':
../../../../../../newlib/libc/sys/psp/pipe.c:234: undefined reference to `sceKernelSendMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_close':
../../../../../../newlib/libc/sys/psp/pipe.c:100: undefined reference to `sceKernelDeleteMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `pipe':
../../../../../../newlib/libc/sys/psp/pipe.c:50: undefined reference to `sceKernelCreateMsgPipe'
../../../../../../newlib/libc/sys/psp/pipe.c:70: undefined reference to `sceKernelDeleteMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_peekmsgsize':
../../../../../../newlib/libc/sys/psp/pipe.c:34: undefined reference to `sceKernelReferMsgPipeStatus'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_read':
../../../../../../newlib/libc/sys/psp/pipe.c:198: undefined reference to `sceKernelReceiveMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_nonblocking_read':
../../../../../../newlib/libc/sys/psp/pipe.c:148: undefined reference to `sceKernelTryReceiveMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_close.o): In function `_close':
../../../../../../newlib/libc/sys/psp/libcglue.c:236: undefined reference to `sceIoClose'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_fstat.o): In function `_fstat':
../../../../../../newlib/libc/sys/psp/libcglue.c:580: undefined reference to `sceIoLseek'
../../../../../../newlib/libc/sys/psp/libcglue.c:582: undefined reference to `sceIoLseek'
../../../../../../newlib/libc/sys/psp/libcglue.c:583: undefined reference to `sceIoLseek'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_lseek.o): In function `_lseek':
../../../../../../newlib/libc/sys/psp/libcglue.c:345: undefined reference to `sceIoLseek'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_read.o): In function `_read':
../../../../../../newlib/libc/sys/psp/libcglue.c:271: undefined reference to `sceIoRead'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_stat.o): In function `_stat':
../../../../../../newlib/libc/sys/psp/libcglue.c:642: undefined reference to `sceIoGetstat'
collect2: ld returned 1 exit status
Add the fno-exceptions flag then produce right result.
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -D_PSP_FW_VERSION=150 -G0 -Wall -O2 -L. -L/usr/local/pspdev/psp/sdk/lib -fno-exceptions t.cpp -lc -lpspgu -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o ZombieStation.elf
t.cpp:8: warning: ISO C++ forbids declaration of 'main' with no type
Code:
#include <pspstdio.h>
#include <pspkernel.h>
#include <pspuser.h>
PSP_MODULE_INFO("Zhen Han Zi", 0x1000, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
main()
{
}
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -D_PSP_FW_VERSION=150 -G0 -Wall -O2 -L. -L/usr/local/pspdev/psp/sdk/lib t.cpp -lc -lpspgu -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o ZombieStation.elf
t.cpp:8: warning: ISO C++ forbids declaration of 'main' with no type
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_write.o): In function `_write':
../../../../../../newlib/libc/sys/psp/libcglue.c:308: undefined reference to `sceIoWrite'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_nonblocking_write':
../../../../../../newlib/libc/sys/psp/pipe.c:258: undefined reference to `sceKernelTrySendMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_write':
../../../../../../newlib/libc/sys/psp/pipe.c:234: undefined reference to `sceKernelSendMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_close':
../../../../../../newlib/libc/sys/psp/pipe.c:100: undefined reference to `sceKernelDeleteMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `pipe':
../../../../../../newlib/libc/sys/psp/pipe.c:50: undefined reference to `sceKernelCreateMsgPipe'
../../../../../../newlib/libc/sys/psp/pipe.c:70: undefined reference to `sceKernelDeleteMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_peekmsgsize':
../../../../../../newlib/libc/sys/psp/pipe.c:34: undefined reference to `sceKernelReferMsgPipeStatus'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_read':
../../../../../../newlib/libc/sys/psp/pipe.c:198: undefined reference to `sceKernelReceiveMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_nonblocking_read':
../../../../../../newlib/libc/sys/psp/pipe.c:148: undefined reference to `sceKernelTryReceiveMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_close.o): In function `_close':
../../../../../../newlib/libc/sys/psp/libcglue.c:236: undefined reference to `sceIoClose'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_fstat.o): In function `_fstat':
../../../../../../newlib/libc/sys/psp/libcglue.c:580: undefined reference to `sceIoLseek'
../../../../../../newlib/libc/sys/psp/libcglue.c:582: undefined reference to `sceIoLseek'
../../../../../../newlib/libc/sys/psp/libcglue.c:583: undefined reference to `sceIoLseek'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_lseek.o): In function `_lseek':
../../../../../../newlib/libc/sys/psp/libcglue.c:345: undefined reference to `sceIoLseek'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_read.o): In function `_read':
../../../../../../newlib/libc/sys/psp/libcglue.c:271: undefined reference to `sceIoRead'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_stat.o): In function `_stat':
../../../../../../newlib/libc/sys/psp/libcglue.c:642: undefined reference to `sceIoGetstat'
collect2: ld returned 1 exit status
Add the fno-exceptions flag then produce right result.
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -D_PSP_FW_VERSION=150 -G0 -Wall -O2 -L. -L/usr/local/pspdev/psp/sdk/lib -fno-exceptions t.cpp -lc -lpspgu -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o ZombieStation.elf
t.cpp:8: warning: ISO C++ forbids declaration of 'main' with no type
I suspect it depends on your library order when linking.
I've not always used -fno-exceptions and I've still got my C++ code to link.
I've not always used -fno-exceptions and I've still got my C++ code to link.
http://aaiiee.wordpress.com/
I can no longer do any homebrew PSP development nor discuss PSP specific topics.
I can no longer do any homebrew PSP development nor discuss PSP specific topics.
i don't know why. every example use this flag doesn't means this way IS correct. the no-exception is used for abandon the C++ exception machnism, right? whats the relationship between the unresolved symbol and the c++ exception?J.F. wrote:Every example I've seen for the PSP adds -fno-exceptions to the c++ flags. I guess now you know why.
why?
Re: strange behavior when using psp-g++ without -fno-excepti
its pretty cool how you are having a problem with compiling with certain flags and you didnt even post your makefile...binch wrote:what you guys has done to this flag? without this flag we can't find many symbols! but it's not the original purpose for this flags in g++.
Code:
#include <pspstdio.h>
#include <pspkernel.h>
#include <pspuser.h>
PSP_MODULE_INFO("Zhen Han Zi", 0x1000, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
main()
{
}
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -D_PSP_FW_VERSION=150 -G0 -Wall -O2 -L. -L/usr/local/pspdev/psp/sdk/lib t.cpp -lc -lpspgu -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o ZombieStation.elf
t.cpp:8: warning: ISO C++ forbids declaration of 'main' with no type
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_write.o): In function `_write':
../../../../../../newlib/libc/sys/psp/libcglue.c:308: undefined reference to `sceIoWrite'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_nonblocking_write':
../../../../../../newlib/libc/sys/psp/pipe.c:258: undefined reference to `sceKernelTrySendMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_write':
../../../../../../newlib/libc/sys/psp/pipe.c:234: undefined reference to `sceKernelSendMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_close':
../../../../../../newlib/libc/sys/psp/pipe.c:100: undefined reference to `sceKernelDeleteMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `pipe':
../../../../../../newlib/libc/sys/psp/pipe.c:50: undefined reference to `sceKernelCreateMsgPipe'
../../../../../../newlib/libc/sys/psp/pipe.c:70: undefined reference to `sceKernelDeleteMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_peekmsgsize':
../../../../../../newlib/libc/sys/psp/pipe.c:34: undefined reference to `sceKernelReferMsgPipeStatus'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_read':
../../../../../../newlib/libc/sys/psp/pipe.c:198: undefined reference to `sceKernelReceiveMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_nonblocking_read':
../../../../../../newlib/libc/sys/psp/pipe.c:148: undefined reference to `sceKernelTryReceiveMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_close.o): In function `_close':
../../../../../../newlib/libc/sys/psp/libcglue.c:236: undefined reference to `sceIoClose'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_fstat.o): In function `_fstat':
../../../../../../newlib/libc/sys/psp/libcglue.c:580: undefined reference to `sceIoLseek'
../../../../../../newlib/libc/sys/psp/libcglue.c:582: undefined reference to `sceIoLseek'
../../../../../../newlib/libc/sys/psp/libcglue.c:583: undefined reference to `sceIoLseek'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_lseek.o): In function `_lseek':
../../../../../../newlib/libc/sys/psp/libcglue.c:345: undefined reference to `sceIoLseek'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_read.o): In function `_read':
../../../../../../newlib/libc/sys/psp/libcglue.c:271: undefined reference to `sceIoRead'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_stat.o): In function `_stat':
../../../../../../newlib/libc/sys/psp/libcglue.c:642: undefined reference to `sceIoGetstat'
collect2: ld returned 1 exit status
Add the fno-exceptions flag then produce right result.
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -D_PSP_FW_VERSION=150 -G0 -Wall -O2 -L. -L/usr/local/pspdev/psp/sdk/lib -fno-exceptions t.cpp -lc -lpspgu -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o ZombieStation.elf
t.cpp:8: warning: ISO C++ forbids declaration of 'main' with no type
- be2003
blog
blog
Re: strange behavior when using psp-g++ without -fno-excepti
why i need to use makefile when i am doing something debug work?be2003 wrote:its pretty cool how you are having a problem with compiling with certain flags and you didnt even post your makefile...binch wrote:what you guys has done to this flag? without this flag we can't find many symbols! but it's not the original purpose for this flags in g++.
Code:
#include <pspstdio.h>
#include <pspkernel.h>
#include <pspuser.h>
PSP_MODULE_INFO("Zhen Han Zi", 0x1000, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
main()
{
}
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -D_PSP_FW_VERSION=150 -G0 -Wall -O2 -L. -L/usr/local/pspdev/psp/sdk/lib t.cpp -lc -lpspgu -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o ZombieStation.elf
t.cpp:8: warning: ISO C++ forbids declaration of 'main' with no type
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_write.o): In function `_write':
../../../../../../newlib/libc/sys/psp/libcglue.c:308: undefined reference to `sceIoWrite'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_nonblocking_write':
../../../../../../newlib/libc/sys/psp/pipe.c:258: undefined reference to `sceKernelTrySendMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_write':
../../../../../../newlib/libc/sys/psp/pipe.c:234: undefined reference to `sceKernelSendMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_close':
../../../../../../newlib/libc/sys/psp/pipe.c:100: undefined reference to `sceKernelDeleteMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `pipe':
../../../../../../newlib/libc/sys/psp/pipe.c:50: undefined reference to `sceKernelCreateMsgPipe'
../../../../../../newlib/libc/sys/psp/pipe.c:70: undefined reference to `sceKernelDeleteMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_peekmsgsize':
../../../../../../newlib/libc/sys/psp/pipe.c:34: undefined reference to `sceKernelReferMsgPipeStatus'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_read':
../../../../../../newlib/libc/sys/psp/pipe.c:198: undefined reference to `sceKernelReceiveMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_nonblocking_read':
../../../../../../newlib/libc/sys/psp/pipe.c:148: undefined reference to `sceKernelTryReceiveMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_close.o): In function `_close':
../../../../../../newlib/libc/sys/psp/libcglue.c:236: undefined reference to `sceIoClose'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_fstat.o): In function `_fstat':
../../../../../../newlib/libc/sys/psp/libcglue.c:580: undefined reference to `sceIoLseek'
../../../../../../newlib/libc/sys/psp/libcglue.c:582: undefined reference to `sceIoLseek'
../../../../../../newlib/libc/sys/psp/libcglue.c:583: undefined reference to `sceIoLseek'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_lseek.o): In function `_lseek':
../../../../../../newlib/libc/sys/psp/libcglue.c:345: undefined reference to `sceIoLseek'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_read.o): In function `_read':
../../../../../../newlib/libc/sys/psp/libcglue.c:271: undefined reference to `sceIoRead'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_stat.o): In function `_stat':
../../../../../../newlib/libc/sys/psp/libcglue.c:642: undefined reference to `sceIoGetstat'
collect2: ld returned 1 exit status
Add the fno-exceptions flag then produce right result.
psp-g++ -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -D_PSP_FW_VERSION=150 -G0 -Wall -O2 -L. -L/usr/local/pspdev/psp/sdk/lib -fno-exceptions t.cpp -lc -lpspgu -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o ZombieStation.elf
t.cpp:8: warning: ISO C++ forbids declaration of 'main' with no type
sure, i run this and get the result, my toolchain is NOT up to date, because i get it from http://www.oopo.net/consoledev/:jimparis wrote:I just built an up-to-date toolchain and retested, there is definitely nothing wrong with pspsdk in this regard. With both -fexceptions and -fno-exceptions your example code compiles just fine. If you're not going to help by providing what we ask for, well, don't expect an answer.
psp-g++ -v
Using built-in specs.
Target: psp
Configured with: ../configure --prefix=/usr/local/pspdev --target=psp --enable-languages=c,c++ --with-newlib --enable-cxx-flags=-G0
Thread model: single
gcc version 4.1.0 (PSPDEV 20060507)
You have a command line that you're using to compile the program. Add -v to that.
Code: Select all
psp-g++ -v -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -D_PSP_FW_VERSION=150 -G0 -Wall -O2 -L. -L/usr/local/pspdev/psp/sdk/lib t.cpp -lc -lpspgu -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o ZombieStation.elf
Hi jimparis,
thanks for your help!
psp-g++ -v -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -D_PSP_FW_VERSION=150 -G0 -Wall -O2 -L. -L/usr/local/pspdev/psp/sdk/lib t.cpp -lc -lpspgu -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o ZombieStation.elf
Using built-in specs.
Target: psp
Configured with: ../configure --prefix=/usr/local/pspdev --target=psp --enable-languages=c,c++ --with-newlib --enable-cxx-flags=-G0
Thread model: single
gcc version 4.1.0 (PSPDEV 20060507)
/usr/local/pspdev/libexec/gcc/psp/4.1.0/cc1plus -quiet -v -I. -I/usr/local/pspdev/psp/sdk/include -DPSP=1 -D__psp__=1 -D_PSP=1 -D_PSP_FW_VERSION=150 t.cpp -G0 -G0 -quiet -dumpbase t.cpp -auxbase t -O2 -O2 -Wall -Wall -version -o /tmp/ccuZSyxU.s
ignoring nonexistent directory "/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/sys-include"
#include "..." search starts here:
#include <...> search starts here:
.
/usr/local/pspdev/psp/sdk/include
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../include/c++/4.1.0
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../include/c++/4.1.0/psp
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../include/c++/4.1.0/backward
/usr/local/pspdev/lib/gcc/psp/4.1.0/include
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/include
End of search list.
GNU C++ version 4.1.0 (PSPDEV 20060507) (psp)
compiled by GNU C version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5).
GGC heuristics: --param ggc-min-expand=81 --param ggc-min-heapsize=96914
Compiler executable checksum: 15e6552522752d2f31558c4d025d24c8
t.cpp:1: warning: ISO C++ forbids declaration of 'main' with no type
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/bin/as -G0 -G0 -EL -O2 -no-mdebug -mabi=eabi -v -mno-pdr -o /tmp/ccQJyjsO.o /tmp/ccuZSyxU.s
GNU assembler version 2.16.1 (psp) using BFD version 2.16.1 (PSPDEV 20060116)
/usr/local/pspdev/libexec/gcc/psp/4.1.0/collect2 -EL -G0 -G0 -o ZombieStation.elf /usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/crt0.o /usr/local/pspdev/lib/gcc/psp/4.1.0/crti.o /usr/local/pspdev/lib/gcc/psp/4.1.0/crtbegin.o -L. -L/usr/local/pspdev/psp/sdk/lib -L/usr/local/pspdev/lib/gcc/psp/4.1.0 -L/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib /tmp/ccQJyjsO.o -lpspgu -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -lstdc++ -lm -lc -lgcc -lgcc /usr/local/pspdev/lib/gcc/psp/4.1.0/crtend.o /usr/local/pspdev/lib/gcc/psp/4.1.0/crtn.o
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_write.o): In function `_write':
../../../../../../newlib/libc/sys/psp/libcglue.c:308: undefined reference to `sceIoWrite'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_nonblocking_write':
../../../../../../newlib/libc/sys/psp/pipe.c:258: undefined reference to `sceKernelTrySendMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_write':
../../../../../../newlib/libc/sys/psp/pipe.c:234: undefined reference to `sceKernelSendMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_close':
../../../../../../newlib/libc/sys/psp/pipe.c:100: undefined reference to `sceKernelDeleteMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `pipe':
../../../../../../newlib/libc/sys/psp/pipe.c:50: undefined reference to `sceKernelCreateMsgPipe'
../../../../../../newlib/libc/sys/psp/pipe.c:70: undefined reference to `sceKernelDeleteMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_peekmsgsize':
../../../../../../newlib/libc/sys/psp/pipe.c:34: undefined reference to `sceKernelReferMsgPipeStatus'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_read':
../../../../../../newlib/libc/sys/psp/pipe.c:198: undefined reference to `sceKernelReceiveMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_nonblocking_read':
../../../../../../newlib/libc/sys/psp/pipe.c:148: undefined reference to `sceKernelTryReceiveMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_close.o): In function `_close':
../../../../../../newlib/libc/sys/psp/libcglue.c:236: undefined reference to `sceIoClose'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_fstat.o): In function `_fstat':
../../../../../../newlib/libc/sys/psp/libcglue.c:580: undefined reference to `sceIoLseek'
../../../../../../newlib/libc/sys/psp/libcglue.c:582: undefined reference to `sceIoLseek'
../../../../../../newlib/libc/sys/psp/libcglue.c:583: undefined reference to `sceIoLseek'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_lseek.o): In function `_lseek':
../../../../../../newlib/libc/sys/psp/libcglue.c:345: undefined reference to `sceIoLseek'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_read.o): In function `_read':
../../../../../../newlib/libc/sys/psp/libcglue.c:271: undefined reference to `sceIoRead'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_stat.o): In function `_stat':
../../../../../../newlib/libc/sys/psp/libcglue.c:642: undefined reference to `sceIoGetstat'
collect2: ld returned 1 exit status
thanks for your help!
psp-g++ -v -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -D_PSP_FW_VERSION=150 -G0 -Wall -O2 -L. -L/usr/local/pspdev/psp/sdk/lib t.cpp -lc -lpspgu -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o ZombieStation.elf
Using built-in specs.
Target: psp
Configured with: ../configure --prefix=/usr/local/pspdev --target=psp --enable-languages=c,c++ --with-newlib --enable-cxx-flags=-G0
Thread model: single
gcc version 4.1.0 (PSPDEV 20060507)
/usr/local/pspdev/libexec/gcc/psp/4.1.0/cc1plus -quiet -v -I. -I/usr/local/pspdev/psp/sdk/include -DPSP=1 -D__psp__=1 -D_PSP=1 -D_PSP_FW_VERSION=150 t.cpp -G0 -G0 -quiet -dumpbase t.cpp -auxbase t -O2 -O2 -Wall -Wall -version -o /tmp/ccuZSyxU.s
ignoring nonexistent directory "/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/sys-include"
#include "..." search starts here:
#include <...> search starts here:
.
/usr/local/pspdev/psp/sdk/include
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../include/c++/4.1.0
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../include/c++/4.1.0/psp
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../include/c++/4.1.0/backward
/usr/local/pspdev/lib/gcc/psp/4.1.0/include
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/include
End of search list.
GNU C++ version 4.1.0 (PSPDEV 20060507) (psp)
compiled by GNU C version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5).
GGC heuristics: --param ggc-min-expand=81 --param ggc-min-heapsize=96914
Compiler executable checksum: 15e6552522752d2f31558c4d025d24c8
t.cpp:1: warning: ISO C++ forbids declaration of 'main' with no type
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/bin/as -G0 -G0 -EL -O2 -no-mdebug -mabi=eabi -v -mno-pdr -o /tmp/ccQJyjsO.o /tmp/ccuZSyxU.s
GNU assembler version 2.16.1 (psp) using BFD version 2.16.1 (PSPDEV 20060116)
/usr/local/pspdev/libexec/gcc/psp/4.1.0/collect2 -EL -G0 -G0 -o ZombieStation.elf /usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/crt0.o /usr/local/pspdev/lib/gcc/psp/4.1.0/crti.o /usr/local/pspdev/lib/gcc/psp/4.1.0/crtbegin.o -L. -L/usr/local/pspdev/psp/sdk/lib -L/usr/local/pspdev/lib/gcc/psp/4.1.0 -L/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib /tmp/ccQJyjsO.o -lpspgu -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -lstdc++ -lm -lc -lgcc -lgcc /usr/local/pspdev/lib/gcc/psp/4.1.0/crtend.o /usr/local/pspdev/lib/gcc/psp/4.1.0/crtn.o
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_write.o): In function `_write':
../../../../../../newlib/libc/sys/psp/libcglue.c:308: undefined reference to `sceIoWrite'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_nonblocking_write':
../../../../../../newlib/libc/sys/psp/pipe.c:258: undefined reference to `sceKernelTrySendMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_write':
../../../../../../newlib/libc/sys/psp/pipe.c:234: undefined reference to `sceKernelSendMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_close':
../../../../../../newlib/libc/sys/psp/pipe.c:100: undefined reference to `sceKernelDeleteMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `pipe':
../../../../../../newlib/libc/sys/psp/pipe.c:50: undefined reference to `sceKernelCreateMsgPipe'
../../../../../../newlib/libc/sys/psp/pipe.c:70: undefined reference to `sceKernelDeleteMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_peekmsgsize':
../../../../../../newlib/libc/sys/psp/pipe.c:34: undefined reference to `sceKernelReferMsgPipeStatus'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_read':
../../../../../../newlib/libc/sys/psp/pipe.c:198: undefined reference to `sceKernelReceiveMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(pipe.o): In function `__psp_pipe_nonblocking_read':
../../../../../../newlib/libc/sys/psp/pipe.c:148: undefined reference to `sceKernelTryReceiveMsgPipe'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_close.o): In function `_close':
../../../../../../newlib/libc/sys/psp/libcglue.c:236: undefined reference to `sceIoClose'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_fstat.o): In function `_fstat':
../../../../../../newlib/libc/sys/psp/libcglue.c:580: undefined reference to `sceIoLseek'
../../../../../../newlib/libc/sys/psp/libcglue.c:582: undefined reference to `sceIoLseek'
../../../../../../newlib/libc/sys/psp/libcglue.c:583: undefined reference to `sceIoLseek'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_lseek.o): In function `_lseek':
../../../../../../newlib/libc/sys/psp/libcglue.c:345: undefined reference to `sceIoLseek'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_read.o): In function `_read':
../../../../../../newlib/libc/sys/psp/libcglue.c:271: undefined reference to `sceIoRead'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_stat.o): In function `_stat':
../../../../../../newlib/libc/sys/psp/libcglue.c:642: undefined reference to `sceIoGetstat'
collect2: ld returned 1 exit status
could you please tell me how you bulid it, you didn't get the build script from oopo.net, right?jimparis wrote:I just built an up-to-date toolchain and retested, there is definitely nothing wrong with pspsdk in this regard. With both -fexceptions and -fno-exceptions your example code compiles just fine. If you're not going to help by providing what we ask for, well, don't expect an answer.
OK, this is the usual library-link-order problem that keeps cropping up on the PSP.
The basic problem is this: the GNU linker keeps a list of unresolved symbols. When it comes across a library like -la, it only pulls symbols from -la as necessary in order to satisfy currently unresolved symbols. The good thing about this is that you don't get bloat because of symbols you don't need. But if some later library needs symbols that were in -la, the linker won't (by default) go back and check -la again to find them.
With shared libraries, the library link order doesn't matter (for various reasons) which is why you don't normally come across this under other operating systems.
The second problem is that our PSP libc is a bit strange because it relies on external libraries (-lpspkernel, etc). The general assumption made by the GNU linker is that -lc has no external dependencies. We've chosen to do things this way for the PSP because it makes it easier to streamline binaries by leaving out the parts you don't need. The upshot is that you always need to include other libraries like -lpspkernel after -lc.
What's happening here is this: When linking with psp-g++, GCC automatically appends the libraries -lstdc++ -lm -lc to the end of the linker command line. When you compile with -fexceptions, the C++ library (-lstdc++) uses some symbols from the C library -lc, which uses some symbols from -lpspkernel. But since this is the end of the command line, -lpspkernel is never searched again for those symbols, and you get the errors.
I don't know if there's a good way to fix it within the PSP toolchain, but there are lots of ways you can fix it in your own program:
The basic problem is this: the GNU linker keeps a list of unresolved symbols. When it comes across a library like -la, it only pulls symbols from -la as necessary in order to satisfy currently unresolved symbols. The good thing about this is that you don't get bloat because of symbols you don't need. But if some later library needs symbols that were in -la, the linker won't (by default) go back and check -la again to find them.
With shared libraries, the library link order doesn't matter (for various reasons) which is why you don't normally come across this under other operating systems.
The second problem is that our PSP libc is a bit strange because it relies on external libraries (-lpspkernel, etc). The general assumption made by the GNU linker is that -lc has no external dependencies. We've chosen to do things this way for the PSP because it makes it easier to streamline binaries by leaving out the parts you don't need. The upshot is that you always need to include other libraries like -lpspkernel after -lc.
What's happening here is this: When linking with psp-g++, GCC automatically appends the libraries -lstdc++ -lm -lc to the end of the linker command line. When you compile with -fexceptions, the C++ library (-lstdc++) uses some symbols from the C library -lc, which uses some symbols from -lpspkernel. But since this is the end of the command line, -lpspkernel is never searched again for those symbols, and you get the errors.
I don't know if there's a good way to fix it within the PSP toolchain, but there are lots of ways you can fix it in your own program:
- Add -Wl,--start-group to the front of your g++ commandline. This will cause the linker to keep searching the list of libraries from the beginning until all symbols are resolved. It means link order generally won't matter anymore, but will slow compilation.
- Add the -lstdc++ library yourself at the beginning of the library list, so that it shows up before the PSP libraries. The extra -lstdc++ etc at the end of the commandline will then have no effect.
- Use some libc functions in your code. For example, if you add a call to "fopen" in your example code, then the necessary stuff is already pulled in from the earlier reference to -lc, and the errors go away.