I use a GCC cross compiler for embedded systems development on my Mac. I use Apple's supplied GCC to build the cross toolchain, but when Apple started using GCC 4.0.x, I could no longer compile the specific version of binutils and GCC that I need.
On PowerPC Macs, I could revert to Apple's GCC 3.3 to compile my toolcain, but on my new Macbook Pro, Xcode does not come with GCC 3.3. It is my understanding that Apple will not be providing a GCC 3.3 for Intel OS X.
Fixing my toolchain to compile with GCC 4.0.x is not an option, because the tools are under configuration management and build fine on all of the other computers in my organization ( cygwin and linux ).
After much expermenting, I finally was able to build Apple's GCC 3.3 so I could then build an Intel OS X hosted version of my cross toolchain.
Here is what I did:
1. Download the source code for Apple's GCC 3.3 in Xcode 2.2 here. Get the file named gcc_os-1819.tar.gz
2. Unpack the source.
$ tar -zxf gcc_os-1819.tar.gz
3. Fix a line that causes it to not compile: in the file gcc_os-1819/gcc/gcc.c, on line 5883, change the line to look like this:
(char ) v[q - vt] = 0;
4. Make a build directory and run configure. I installed my compiler in /opt/gcc3, and I only built the C compiler. This would not work for building C++ or Cocoa applications.
$ mkdir build
$ cd build
$ ../gcc_os-1819/configure --prefix=/opt/gcc3 --enable-languages=c
5. Build the compiler:
$ /opt/gcc3/bin/gcc -v
Reading specs from /opt/gcc3/lib/gcc-lib/i686-apple-darwin8.6.1/3.3/specs
Configured with: ../gcc_os-1819/configure --prefix=/opt/gcc3 --enable-languages=c
Thread model: single
gcc version 3.3 20030304 (Apple Computer, Inc. build 1819)
Now, you can use the compiler to build Unix packages that will not build with GCC 4.0.x.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20060423105014540