Page 1 of 1

Newbie PS2SDK build question

Posted: Tue Aug 03, 2004 8:28 am
by Waruwaru
Pardon for the newbie build question. I grabbed the PS2SDK v1.0 Alpha yesterday. Couldn't use the scr_printf() function, and the suggested fix in forum was to include debug.h (which is only available in the current CVS tree). So I just downloaded Cygwin (installed GCC 3.3.1-3) on my WinXP machine, synced down the sources from cvs.ps2dev.org. Set up my env variables as

Code: Select all

PS2GCC=c:\ps2dev\gcc
PS2SDKSRC=c:\ps2sdksrc\ps2sdk
Attempted to make from %PS2SDKSRC% and got

Code: Select all

make -C tools
make[1]: Entering directory `/cygdrive/c/ps2sdksrc/ps2sdk/tools'
make -C bin2s
make[2]: Entering directory `/cygdrive/c/ps2sdksrc/ps2sdk/tools/bin2s'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/cygdrive/c/ps2sdksrc/ps2sdk/tools/bin2s'
make[1]: Leaving directory `/cygdrive/c/ps2sdksrc/ps2sdk/tools'
make -C iop
make[1]: Entering directory `/cygdrive/c/ps2sdksrc/ps2sdk/iop'
make -C kernel
make[2]: Entering directory `/cygdrive/c/ps2sdksrc/ps2sdk/iop/kernel'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/cygdrive/c/ps2sdksrc/ps2sdk/iop/kernel'
make -C dev9
make[2]: Entering directory `/cygdrive/c/ps2sdksrc/ps2sdk/iop/dev9'
make -C dev9
make[3]: Entering directory `/cygdrive/c/ps2sdksrc/ps2sdk/iop/dev9/dev9'
iop-gcc  -O2 -G0 -c  -Ic:\ps2sdksrc\ps2sdk/iop/kernel/include -Ic:\ps2sdksrc\ps2sdk/common/include -Iinclude -Wall -fno-builtin-printf src/ps2dev9.c -o obj/ps2dev9.o
cpp: -lang-c: linker input file unused because linking not done
In file included from c:/ps2sdksrc/ps2sdk/iop/kernel/include/types.h:13,
                 from src/ps2dev9.c:13:
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/include/stddef.h:0: warning: unrecognized text at end of #line
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/include/stddef.h:157: warning: unrecognized text at end of #line
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/include/stddef.h:219: warning: unrecognized text at end of #line
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/include/stddef.h:331: warning: unrecognized text at end of #line
as: unrecognized option `-G0'
make[3]: *** [obj/ps2dev9.o] Error 1
make[3]: Leaving directory `/cygdrive/c/ps2sdksrc/ps2sdk/iop/dev9/dev9'
make[2]: *** [all-dev9] Error 2
make[2]: Leaving directory `/cygdrive/c/ps2sdksrc/ps2sdk/iop/dev9'
make[1]: *** [all-dev9] Error 2
make[1]: Leaving directory `/cygdrive/c/ps2sdksrc/ps2sdk/iop'
make: *** [all-iop] Error 2
Running a make from within C:\ps2sdksrc\ps2sdk\iop\dev9\dev9

Code: Select all

mkdir obj/
mkdir bin/
iop-gcc  -O2 -G0 -c  -Ic:\ps2sdksrc\ps2sdk/iop/kernel/include -Ic:\ps2sdksrc\ps2sdk/common/include -Iinclude -Wall -fno-builtin-printf src/ps2dev9.c -o obj/ps2dev9.o
In file included from src/ps2dev9.c:13:
c:\ps2sdksrc\ps2sdk/iop/kernel/include/types.h:13: stddef.h: No such file or directory
make: *** [obj/ps2dev9.o] Error 1
Looking for stddef.h on in the ps2 related directory, I got

Code: Select all

C:\ps2dev\gcc\ee\lib\gcc-lib\ee\3.2.2\include\stddef.h
C:\ps2dev\gcc\ee\lib\gcc-lib\ee\3.2.2\include\gcc\ginclude\stddef.h
C:\ps2dev\gcc\iop\lib\gcc-lib\iop\2.8.1-ps2dev\include\stddef.h
Does that mean, I need to add the C:\ps2dev\gcc\iop\lib\gcc-lib\iop\2.8.1-ps2dev\include to the C:\ps2sdksrc\ps2sdk\iop\Rules.make? Or my environment is still not set up properly? Thanks for any clues you can toss my way.

Posted: Tue Aug 03, 2004 11:40 am
by Waruwaru
Alright, finally got it to work. I think I had a few problems:

1) cvs was converting LF/CF between *nix and DOS, so that was causing weird errors (stray '/'s)
2) the toolchain I grabed from Lukasz's site was conflicting with my installation of Cygwin.
3) Most developers are probably developing on *nix, so had to make a few changes to the makefiles (putting quotes around the param for mkdir, removing quotes from echo command)

Since I had conflicts with Cygwin, I was using DOS in WinXP only (not in a bash shell). First set up your env vars like

Code: Select all

set PS2GCC=c:\ps2dev\gcc
set PS2SDK=c:/ps2sdk
set PS2SDKSRC=c:\ps2sdksrc\ps2sdk
Download WinCVS, sync out ps2sdk from cvs, make sure you have "Checkout text files with the Unix LF (0xa)" checked on. Now all files downloaded should be in Unix format. Loading into Notepad will look like one giant garble of mess. Make sure you edit things using an *nix friendly editor to make modifications. I was using CVS in Cygwin, and that was doing conversions. I guess if I mount the drive in binary mode, I would've been ok (untested theory).

While Cygwin's GCC is in the front of the path (before Lukasz's toolchain), build bin2s.exe in C:\ps2sdksrc\ps2sdk\tools\bin2s.

Here is my diff against the server, most of it can be wrapped in makefile OS testing, not sure if the new include path is correct.

Code: Select all

Index: ee/Rules.make
===================================================================
RCS file: /home/ps2cvs/ps2sdk/ee/Rules.make,v
retrieving revision 1.7
diff -r1.7 Rules.make
43c43
< 	mkdir $&#40;EE_LIB_DIR&#41;
---
> 	mkdir "$&#40;EE_LIB_DIR&#41;"
46c46
< 	mkdir $&#40;EE_BIN_DIR&#41;
---
> 	mkdir "$&#40;EE_BIN_DIR&#41;"
49c49
< 	mkdir $&#40;EE_OBJS_DIR&#41;
---
> 	mkdir "$&#40;EE_OBJS_DIR&#41;"

cvs server&#58; Diffing iop
Index&#58; iop/Rules.make
===================================================================
RCS file&#58; /home/ps2cvs/ps2sdk/iop/Rules.make,v
retrieving revision 1.3
diff -r1.3 Rules.make
20c20
< IOP_INCS &#58;= $&#40;IOP_INCS&#41; -I$&#40;PS2SDKSRC&#41;/iop/kernel/include -I$&#40;PS2SDKSRC&#41;/common/include -Iinclude
---
> IOP_INCS &#58;= $&#40;IOP_INCS&#41; -I$&#40;PS2SDKSRC&#41;/iop/kernel/include -I$&#40;PS2SDKSRC&#41;/common/include  -I$&#40;PS2GCC&#41;\iop\lib\gcc-lib\iop\2.8.1-ps2dev\include -Iinclude
24c24
< IOP_LDFLAGS &#58;= $&#40;LDFLAGS_TARGET&#41; -nostdlib $&#40;IOP_LDFLAGS&#41;
---
> IOP_LDFLAGS &#58;= $&#40;LDFLAGS_TARGET&#41; -L $&#40;PS2GCC&#41;\iop\lib\gcc-lib\iop\2.8.1-ps2dev -nostdlib $&#40;IOP_LDFLAGS&#41;
36c36
< 	echo "#include \"irx_imports.h\"" > $&#40;IOP_OBJS_DIR&#41;build-imports.c
---
> 	echo #include "irx_imports.h" > $&#40;IOP_OBJS_DIR&#41;build-imports.c
43c43
< 	echo "#include \"irx.h\"" > $&#40;IOP_OBJS_DIR&#41;build-exports.c
---
> 	echo #include "irx.h" > $&#40;IOP_OBJS_DIR&#41;build-exports.c
49c49
< 	mkdir $&#40;IOP_OBJS_DIR&#41;
---
> 	mkdir "$&#40;IOP_OBJS_DIR&#41;"
52c52
< 	mkdir $&#40;IOP_BIN_DIR&#41;
---
> 	mkdir "$&#40;IOP_BIN_DIR&#41;"
55c55
< 	mkdir $&#40;IOP_LIB_DIR&#41;
---
> 	mkdir "$&#40;IOP_LIB_DIR&#41;"

cvs server&#58; Diffing tools
Index&#58; tools/Rules.make
===================================================================
RCS file&#58; /home/ps2cvs/ps2sdk/tools/Rules.make,v
retrieving revision 1.1
diff -r1.1 Rules.make
42c42
< 	mkdir $&#40;TOOLS_BIN_DIR&#41;
---
> 	mkdir "$&#40;TOOLS_BIN_DIR&#41;"
45c45
< 	mkdir $&#40;TOOLS_OBJS_DIR&#41;
---
> 	mkdir "$&#40;TOOLS_OBJS_DIR&#41;"
Remove Cygwin/bin from your path (or put Lukasz toolchain in front), and go into iop and run make to build iop. After it succeeds, go into ee and run make to build ee.

After both succeeds, put Cygwin/bin back into the front of your path. You should be able to go to the ps2sdk root and run make release, which copies everything into %PS2SDK%. If you have problems, make sure env var PS2SDK has the proper slashes.[/url]