Hello everyone,
During an attempt to recompile some sources that I have created a while ago, I reinstalled the PS2SDK and found out it gives the following linker error when the files are named .cpp (not when they are .c):
undefined reference to __gxx_personality_v0
Now my problem is that I need to use some c++ features and therefore am no longer able to compile the project. Does anybody know how I can fix this?
Also, how can I export symbols using the dvp assembler so the linker will recognize them?
Any help is very much appreciated! Thanks in advance!
Problems with cpp files
I found another topic in this list called "C++ problems", where the same thing is discussed. However, adding the line
EE_CXXFLAGS += -fno-exceptions
or adding -lstdc++ both still give problems. The no exceptions flag does not change anything, while the -lstdc++ brings a new huge list of unresolved external symbols ('abort').
Does anybody know how to solve this?
EE_CXXFLAGS += -fno-exceptions
or adding -lstdc++ both still give problems. The no exceptions flag does not change anything, while the -lstdc++ brings a new huge list of unresolved external symbols ('abort').
Does anybody know how to solve this?
The fix was to reinstall the entire SDK and add the -lstdc++ line to the makefile.
Also linking VU code works well now. However, there is a new problem:
When I try to compile projects with multiple files, there are compiler errors when there are c++ files used together with the graph and math libraries. This happens only when I try to access functions outside the cpp file, such as an assembler function from another file.
The errors are as follows:
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/libgcc.a(unwind-dw2.o)(../../gcc/unwind-dw2.c:226: undefined reference to 'strlen'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/libgcc.a(unwind-dw2-fde.o)(.text+0x5d4): In function 'get_cie_encoding':
../../gcc/unwind-dw2-fde.c:271: undefined reference to 'strlen'
collect2: ld returned 1 exit status
make: *** [vudemo.elf] Error 1
The following flags are set for the linker: -lstdc++ -lc -lgraph -ldma -lmath3d -lmf -lpacket -lc -lsyscall -lkernel
Any ideas how I might fix this? Thanks in advance.
Also linking VU code works well now. However, there is a new problem:
When I try to compile projects with multiple files, there are compiler errors when there are c++ files used together with the graph and math libraries. This happens only when I try to access functions outside the cpp file, such as an assembler function from another file.
The errors are as follows:
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/libgcc.a(unwind-dw2.o)(../../gcc/unwind-dw2.c:226: undefined reference to 'strlen'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/libgcc.a(unwind-dw2-fde.o)(.text+0x5d4): In function 'get_cie_encoding':
../../gcc/unwind-dw2-fde.c:271: undefined reference to 'strlen'
collect2: ld returned 1 exit status
make: *** [vudemo.elf] Error 1
The following flags are set for the linker: -lstdc++ -lc -lgraph -ldma -lmath3d -lmf -lpacket -lc -lsyscall -lkernel
Any ideas how I might fix this? Thanks in advance.
Well you need to make sure the other C header files have the wrapper around them like so:
That way you wont get the undefined reference.
Code: Select all
#ifdef __cplusplus
extern "C" {
#endif
.... function defs here
#ifdef __cplusplus
}
Thanks for your help!
Unfortunately, it did not fix the problem, since they were already inside.
I am using the makefiles supplied with the PS2SDK, and have tried both the C and C++ versions. The only small difference is the DVP assembler which has been added to it, although it does not make a difference if I leave it out.
In the meantime, I have continued on the VPU side by using C/assembler only. I will try C++ again as soon as I have an idea of how to fix it.
I am trying to unpack data through VU1 to draw polygons using the XGKICK instruction and did the following thing:
I have made a small display list for drawing polygons and it works well when using PATH2/3. The display list is basically a GIFTag with a single 0x0e (A+D) register desription and PACKED data after that (RGBAQ/XYZ2). However, when I use the UNPACK instruction (including NOPs for alignment and FLUSH) the system hangs and needs to be rebooted since Pukklink crashes along with it. This also happens when I access the VU1 memory from the CPU side directly and execute the XGKICK instruction.
The XGKICK instruction is disabled at this moment and the system still hangs after execution of the UNPACK instruction (sometimes it takes a few frames before it hangs). When I change the RGBAQ and XYZ2 registers to zero instead of a useful value (in the display list) the system somehow does not hang anymore....
Any ideas? Please let me know if you know a solution. Thanks!
Unfortunately, it did not fix the problem, since they were already inside.
I am using the makefiles supplied with the PS2SDK, and have tried both the C and C++ versions. The only small difference is the DVP assembler which has been added to it, although it does not make a difference if I leave it out.
In the meantime, I have continued on the VPU side by using C/assembler only. I will try C++ again as soon as I have an idea of how to fix it.
I am trying to unpack data through VU1 to draw polygons using the XGKICK instruction and did the following thing:
I have made a small display list for drawing polygons and it works well when using PATH2/3. The display list is basically a GIFTag with a single 0x0e (A+D) register desription and PACKED data after that (RGBAQ/XYZ2). However, when I use the UNPACK instruction (including NOPs for alignment and FLUSH) the system hangs and needs to be rebooted since Pukklink crashes along with it. This also happens when I access the VU1 memory from the CPU side directly and execute the XGKICK instruction.
The XGKICK instruction is disabled at this moment and the system still hangs after execution of the UNPACK instruction (sometimes it takes a few frames before it hangs). When I change the RGBAQ and XYZ2 registers to zero instead of a useful value (in the display list) the system somehow does not hang anymore....
Any ideas? Please let me know if you know a solution. Thanks!