Although Xcode 2.5 says it's compatible with 10.5, I downloaded it and it only had a toolchain for Darwin 8, which is not the kernel I have, so I can't link anything :/ I also tried a MacPorts version of gcc 4.4.0, but the same problem as with Xcode 3's 4.0.1. I ended up downloading an unofficial build of 1.1.21, which actually worked great.