Page 1 of 1

Current PS2SDK fails to compile.

Posted: Wed Oct 19, 2005 9:22 am
by dlanor
In attempting to compile the current PS2SDK sources I get the following results:

Code: Select all

iop-gcc  -O2 -G0 -c  -I/usr/local/ps2dev/ps2sdk_src/iop/kernel/include -I/usr/local/ps2dev/ps2sdk_src/common/include -Iinclude -Wall -fno-builtin-printf -fno-builtin-memcpy -std=c99 src/ps2snd.c -o obj/ps2snd.o
iop-gcc: unrecognized option `-std=c99'
src/ps2snd.c: In function `_start':
src/ps2snd.c:129: parse error before `)'
make[3]: *** [obj/ps2snd.o] Error 1
make[3]: Leaving directory `/usr/local/ps2dev/_ps2sdk_src/ps2sdk-2005.10.19/iop/
sound/ps2snd'
make[2]: *** [all-ps2snd] Error 2
make[2]: Leaving directory `/usr/local/ps2dev/_ps2sdk_src/ps2sdk-2005.10.19/iop/
sound'
make[1]: *** [all-sound] Error 2
make[1]: Leaving directory `/usr/local/ps2dev/_ps2sdk_src/ps2sdk-2005.10.19/iop'

make: *** [all-iop] Error 2
Since the first error message refers to an unrecognized option of iop-gcc, I assume that the rest simply result from the failure to use that option. But why that error in the first place ? Is this some option that requires a newer version of iop-gcc than v2.8.1, which I use ?

If so, then what about the problem that v3.2.2 produces IRXs that simply don't work properly ?
Is there a newer version available which fixes that ?

Best regards: dlanor

Posted: Wed Oct 19, 2005 10:05 pm
by jbit
Gah! That would be my code, sorry. I'll add a hack into the makefile to check for the IOP compiler version now.

I use iop-gcc 3.2.2, and it works fine. I don't have any problems with IRXs that "simply don't work properly". All the IRXs i've compiled with it work fine...

EDIT: "Fixed" in rev 1226. It'll skip compiling the ps2snd module with old iop-gcc's now. If you want to use ps2snd you'll have to upgrade your toolchain, sorry. ;)

Posted: Sat Oct 22, 2005 5:45 am
by dlanor
jbit wrote:Gah! That would be my code, sorry. I'll add a hack into the makefile to check for the IOP compiler version now.
Good, that should at least solve the immediate problems.
I use iop-gcc 3.2.2, and it works fine. I don't have any problems with IRXs that "simply don't work properly". All the IRXs i've compiled with it work fine...
Sorry I can't say the same...
I am not exactly alone in having this problem (NB: huge understatement), so I hope someone with insight into the iop-gcc sources can fix this sometime in the future. There is definitely something wrong with the optimizations inherent to -O2 (and higher).

Using iop-gcc 3.2.2 many projects will work right only if compiled with all optimizations turned off, resulting in hugely bloated code. Yet the same projects work fine when compiled by iop-gcc 2.8.1 with -O2.

At first I thought this was merely due to different optimization defaults in the two versions, and that the affected projects could be fixed by using different options. Unfortunately I never found settings that give the same results as iop-gcc 2.8.1 does.
EDIT: "Fixed" in rev 1226. It'll skip compiling the ps2snd module with old iop-gcc's now. If you want to use ps2snd you'll have to upgrade your toolchain, sorry. ;)
Ok, I can easily switch back and forth between the two compilers, and I already do switch between several different PS2SDK versions, for experiments, so doing this is not a problem in itself.

The real problem here its that PS2SDK as a whole has thus become limited to being compiled with a version of iop-gcc that is suspect (at least to me, and many others). This is not good !!!

However, a possible workaround for this would be to compile two versions of PS2SDK. One using v3.2.2 and one using v2.8.1 of iop-gcc, and then copying the fully functional ps2snd module from the former to the latter. That should fix the problem for my own purposes anyway, though I strongly recommend rewriting the code so that either compiler can handle it.

Best regards: dlanor

Posted: Sat Oct 22, 2005 8:24 pm
by jbit
Hrm....
I'm definitely using 3.2.2, and I'm definitely using -O2 optimisations.
All the IRXs in ps2sdk compile and run fine.
All other IRXs that I've attempted to use compile and run fine.
Several other people use 3.2.2 and get working output too.

I remember that there were some problems with iop-gcc 3.2.2 back in the early days, but afaik that's all been fixed now.
If you're using an old version of iop-gcc, try using the latest from svn://svn.ps2dev.org/ps2/trunk/ps2toolchain

I'd like to see some real examples of the latest iop-gcc 3.2.2 failing to compile something, or giving broken output. It'd be useful to have the code of the IRX, the build setup, and the broken IRX output.

Remember, it's possible to build a broken toolchain using working patches, so check that out first. (Last time I checked, GCC & Binutils hate being compiled with optimisations)

Posted: Sat Nov 05, 2005 1:41 pm
by EP
jbit wrote:I'd like to see some real examples of the latest iop-gcc 3.2.2 failing to compile something, or giving broken output. It'd be useful to have the code of the IRX, the build setup, and the broken IRX output.

Remember, it's possible to build a broken toolchain using working patches, so check that out first. (Last time I checked, GCC & Binutils hate being compiled with optimisations)
Ok, if you need an example take a look at ps2ftpd. Compile it with the newer iop and watch it crash. Just load up ps2link then load ps2ftpd.irx and try to transfer a file to mc and you'll get an exception. No problems with the older iop here.

I get this when compiling with iop-3.2.2

Code: Select all

E:\cygwin\usr\local\ps2dev\ps2ftpd>make
mkdir obj/
mkdir bin/
iop-gcc -miop -O2 -G0 -c -IE:/cygwin/usr/local/ps2dev/ps2sdk/iop/include -IE:/cy
gwin/usr/local/ps2dev/ps2sdk/common/include -Iinclude -Wall -fno-builtin src/mai
n.c -o obj/main.o
iop-gcc -miop -O2 -G0 -c -IE:/cygwin/usr/local/ps2dev/ps2sdk/iop/include -IE:/cy
gwin/usr/local/ps2dev/ps2sdk/common/include -Iinclude -Wall -fno-builtin src/Fil
eSystem.c -o obj/FileSystem.o
iop-gcc -miop -O2 -G0 -c -IE:/cygwin/usr/local/ps2dev/ps2sdk/iop/include -IE:/cy
gwin/usr/local/ps2dev/ps2sdk/common/include -Iinclude -Wall -fno-builtin src/Ftp
Server.c -o obj/FtpServer.o
iop-gcc -miop -O2 -G0 -c -IE:/cygwin/usr/local/ps2dev/ps2sdk/iop/include -IE:/cy
gwin/usr/local/ps2dev/ps2sdk/common/include -Iinclude -Wall -fno-builtin src/Ftp
Client.c -o obj/FtpClient.o
iop-gcc -miop -O2 -G0 -c -IE:/cygwin/usr/local/ps2dev/ps2sdk/iop/include -IE:/cy
gwin/usr/local/ps2dev/ps2sdk/common/include -Iinclude -Wall -fno-builtin src/Ftp
Commands.c -o obj/FtpCommands.o
iop-gcc -miop -O2 -G0 -c -IE:/cygwin/usr/local/ps2dev/ps2sdk/iop/include -IE:/cy
gwin/usr/local/ps2dev/ps2sdk/common/include -Iinclude -Wall -fno-builtin src/Ftp
Messages.c -o obj/FtpMessages.o
echo "#include "irx_imports.h"" > obj/build-imports.c
cat src/imports.lst >> obj/build-imports.c
iop-gcc -miop -O2 -G0 -c -IE:/cygwin/usr/local/ps2dev/ps2sdk/iop/include -IE:/cy
gwin/usr/local/ps2dev/ps2sdk/common/include -Iinclude -Wall -fno-builtin -Isrc/
obj/build-imports.c -o obj/imports.o
/cygdrive/e/DOCUME~1/Administrator/LOCALS~1/Temp/ccfoXaF0.s: Assembler messages:
/cygdrive/e/DOCUME~1/Administrator/LOCALS~1/Temp/ccfoXaF0.s:4: Warning: ignoring changed
section attributes for .text
rm -f obj/build-imports.c
iop-gcc -miop -nostdlib -s -o bin/ps2ftpd.irx obj/main.o obj/FileSystem.o obj/Ft
pServer.o obj/FtpClient.o obj/FtpCommands.o obj/FtpMessages.o obj/imports.o

E:\cygwin\usr\local\ps2dev\ps2ftpd>
vs. this when compiling with iop-2.8.1 that works properly

Code: Select all

E:\cygwin\usr\local\ps2dev\ps2ftpd>make
mkdir obj/
mkdir bin/
iop-gcc  -O2 -G0 -c -IE:/cygwin/usr/local/ps2dev/ps2sdk/iop/include -IE:/cygwin/
usr/local/ps2dev/ps2sdk/common/include -Iinclude -Wall -fno-builtin src/main.c -
o obj/main.o
iop-gcc  -O2 -G0 -c -IE:/cygwin/usr/local/ps2dev/ps2sdk/iop/include -IE:/cygwin/
usr/local/ps2dev/ps2sdk/common/include -Iinclude -Wall -fno-builtin src/FileSyst
em.c -o obj/FileSystem.o
iop-gcc  -O2 -G0 -c -IE:/cygwin/usr/local/ps2dev/ps2sdk/iop/include -IE:/cygwin/
usr/local/ps2dev/ps2sdk/common/include -Iinclude -Wall -fno-builtin src/FtpServe
r.c -o obj/FtpServer.o
iop-gcc  -O2 -G0 -c -IE:/cygwin/usr/local/ps2dev/ps2sdk/iop/include -IE:/cygwin/
usr/local/ps2dev/ps2sdk/common/include -Iinclude -Wall -fno-builtin src/FtpClien
t.c -o obj/FtpClient.o
iop-gcc  -O2 -G0 -c -IE:/cygwin/usr/local/ps2dev/ps2sdk/iop/include -IE:/cygwin/
usr/local/ps2dev/ps2sdk/common/include -Iinclude -Wall -fno-builtin src/FtpComma
nds.c -o obj/FtpCommands.o
iop-gcc  -O2 -G0 -c -IE:/cygwin/usr/local/ps2dev/ps2sdk/iop/include -IE:/cygwin/
usr/local/ps2dev/ps2sdk/common/include -Iinclude -Wall -fno-builtin src/FtpMessa
ges.c -o obj/FtpMessages.o
echo "#include "irx_imports.h"" > obj/build-imports.c
cat src/imports.lst >> obj/build-imports.c
iop-gcc  -O2 -G0 -c -IE:/cygwin/usr/local/ps2dev/ps2sdk/iop/include -IE:/cygwin/
usr/local/ps2dev/ps2sdk/common/include -Iinclude -Wall -fno-builtin -Isrc/ obj/b
uild-imports.c -o obj/imports.o
rm -f obj/build-imports.c
iop-gcc  -nostdlib -s -o bin/ps2ftpd.irx obj/main.o obj/FileSystem.o obj/FtpServ
er.o obj/FtpClient.o obj/FtpCommands.o obj/FtpMessages.o obj/imports.o

E:\cygwin\usr\local\ps2dev\ps2ftpd>
Sorry, If I haven't been of much help, I'm not a gcc guy.

Posted: Fri Nov 18, 2005 11:16 am
by EP
Here is where the discusion was earlier about an issue with the newer IOP compiler and ps2ftpd.

This is the exception error you'll get when loading ps2ftpd module through ps2link and then transfering a file to memory card.

Code: Select all

IOP Exception handler: Address load/inst fetch exception

Module Name "mcman" Relative EPC 0000fee8

Cause 30000010 BadVAddr 00000602 Status 00000404 EPC 0004df18

zero: 00000000  t0: 00000021  t8: 00000001  s6: 00000000
  at: 00000000  t1: 77631C43  t9: 00000602  s7: 00000000
  v0: 00000762  t2: 7F777F7F  s0: 00067CD0  k0: 00070D90
  v1: 00055C90  t3: 7F7F777F  s1: 00068060  k1: 00032A0D
  a0: 00000802  t4: 00000000  s2: 00000602  gp: 00081890
  a1: 0000002F  t5: 00000000  s3: 00000602  sp: 001ECB18
  a2: 000798A6  t6: 00000000  s4: 00000002  fp: 00000000
  a3: 0000000A  t7: 00000000  s5: 00000000  ra: 0004DEFC