building a gcc powerpc/linux cross compiler for sparc/solaris
there are a number of resources on the internet serving as a guide for building a cross compiler. however, each addresses a particular version of the compiler as well as a particular host/target combination; which while generally useful as a base instruction set, doesn't cover the intricacies of performing the feat for a different version and host/target combination. this attempts to document the process of building a gcc 2.95.2 cross compiler for powerpc/linux 2.4.0 on sparc/ solaris 2.7 (aka solaris 7, sunos 5.7).
conventions
in the instructions below, the following conventions are used:
| <archive dir> | location in which you store your archive (i.e. *.tar.gz) files. |
| <source dir> | location in which you unpack your archive files as various source directories. |
| <object dir> | location in which you will build object files from the source dirctories located in <source dir>. this may be the same as <source dir>; however, that is not recommended. |
| <tool dir> | location in which you will place all of the built cross-compiler tools and libraries. |
| gmake | gnu version of make |
| gtar | gnu version of tar |
instructions
most of the following steps should work fine with default system tools. however, the process for building tends to make a number of assumptions about running with a gnu tool set, in particular, a native gcc compiler. that said, it may be useful (i certainly found it to be) to have /usr/local/gnu/bin or an equivalent gnu tool set in your path before your normal system tools (/usr/bin, /usr/xpg4/bin, /usr/ucb, etc.). i used these tools.
it is also highly encouraged that all the below commands be run while using bash (preferrably) or ksh as your shell. you will likely even have better luck if you set the environment variable shell to bash or ksh. all the subsequent examples will assume that this is the case. adjust accordingly if you are using csh, tcsh or some other shell.
changing the optimization level of the compiler (e.g. -o3), either via cflags or by another means, is not recommened. doing so will likely result in either a failed build step in glibc or a broken cross-compilation environment.