So here are my steps, in case you want to redo this.

First, read the txt file above carefully. It's almost correct, but slightly out of date. First of all, I used the 3.1.4 XCode package from the apple connect site, but his method of extraction is perfectly valid. I also used the 10.4u framework, but I was installing stuff in /usr instead, which means I copied the contents of SDKs/MacOSX10.4u.sdk/usr directory into /usr/i686-apple-darwin9 directory, straight. And I copied the System one into my / directory.

About the distribution; he's right saying there's an odd behavior on a 32 bits system, and he's right saying that compiling the compiler in native 64 bits isn't working properly. So the only dev environment able to do that kind of compilation is actually CentOS x86_64. But the generated binaries were able to run properly in my 32 bits Debian system.

Then about odcctools; his last two patches aren't applying properly. I'm actually having troubles with ld64 anyway, so I'm not bothering. My configure line was:

LDFLAGS="-m32" CFLAGS="-m32"  ./configure --prefix=/usr --target=$TARGET

About GCC, I used this version here: http://www.opensource.apple.com/tarballs/gcc/gcc-5646.1.tar.gz. It's a gcc 4.2.1, which is something I needed, but this one also doesn't contain libstdc++, which isn't going to help you if you want to compile C+ + code. The version he's talking about in his code is valid, and libstdc+ + compiles properly - but it's a gcc 4.0.1, which is slightly too old for my usage. So I also had to download this package here: http://www.opensource.apple.com/tarballs/libstdcxx/libstdcxx-39.tar.gz, then I applied all the patches in the patches-4.2.1 folder onto the libstdc+ + folder, and I finally copied the whole thing over the gcc-5646.1's directory.

My gcc compilation line was this:

CFLAGS="-m32" LDFLAGS="-m32" ../gcc-5646.1/configure --prefix=/usr --disable-checking --enable-languages=c,objc,c++,obj-c++ --with-as=/usr/bin/${TARGET}-as --with-ld=/usr/bin/${TARGET}-ld --target=$TARGET --enable-static --enable-shared --disable-nls --disable-multilib

And... that was it! :)

So far my tests are reporting that everything works fine. I'll do more in-depth tests later, in order to fully check the status of the environment, but so far so good.

Also, if you want, here's a package containing the compiled binaries for linux32, which have been compiled from CentOS 5.2, but seem to work under Debian 32 bits as well: http://static.grumpycoder.net/pixel/apple-darwin9-dist.tar.gz

Update: ld64 wasn't viable during compilation, but then the normal ld becomes inviable during its normal usage, since we're having 10.5 libraries. However, CentOS's OpenSSL library is a bit too specific to that platform. And gcc was compiled using ld and not ld64 by default.

All in all, here's a new ld64 binary, that I put in place of the i686-apple-darwin9-ld file, and everything seems to be working perfectly fine now: http://static.grumpycoder.net/pixel/ld64