This page describes how to build and install gcc as a cross-compiler on a linux PC (or any linux system, really). This means that you could, for example, build programs on your [probably much faster] PC and then run them on your ps2 linux system.
Most people would probably be happier installing pre-built tarballs. which version?First you'll need to decide which version of gcc to build.Getting the source2.95.2The gcc source rpm should be on disc 2:/SRPMS. After installing it with 'rpm -i' the gcc source tarball and several patches will be in /usr/src/RPM/SOURCES. Copy these onto the PC you'll be using to develop. before we begingcc needs a few programs to build that are part of the binutils package, so you'll need to build and install the binutils package.gcc's executables depend on several system libraries and headers, so we'll need to make them available before building gcc. This will be true for pretty much anything that you'll build for your ps2 linux system, so now is a good time to bring over a bunch of libraries and headers from your ps2. gcc will, by default, look in the directory /usr/local/ps2/mipsEEel-linux/sys-include for headers, so I do a recursive copy of /usr/include on my ps2 into this directory. To be honest, I don't know what the minimum set of headers is to get gcc to build. As for libraries, I like to put them in /usr/local/ps2/mipsEEel-linux/lib. Here's what you'll need to bring over to your PC: from /usr/lib:
from /lib
configure and buildOnce you've got headers and libraries you're almost ready to build. Before doing so, gcc needs to be able to find the binutils binaries, so add '/usr/local/ps2/bin' to your path. So, let's build:gcc 2.95.22.95.2 comes with libstdc++ and builds it as part of the gcc build process, but since it was just copied over from the ps2 system it isn't needed. I've also found it problematic to build, so I recommend removing the 'libstdc++' from the gcc source tree as below.
ln -s ../../mipsEEel-linux/sys-include/g++-3/* .There will be a few errors, but don't worry about them. Now the c++ standard library:
gcc 3.0.3
and last of all..As with binutils, I like to refer to gcc as 'ee-gcc' not 'mipsEEel-linux-gcc' and use this line to add aliases for the binaries in /usr/local/ps2/bin:find . -name 'mipsEE*' -exec bash -c 'ln -s {} `echo {} | sed s,\./mipsEEel\-linux,ee,`' \; |