configure: error: C compiler cannot create executables See `config.log' for more details.
What?!? Isn't that the entire purpose of a compiler?!?
So, this one threw me for a loop when I came across it on an older Debian sarge machine. I know that the "best" thing for this server would be to upgrade it to squeeze or even lenny, but that was not really an option at this point. I came across many articles stating that installing g++ or build-essential (which includes g++) is the fix. Even with the latest versions of these packages available for sarge, the problem persisted.
Upon further investigation, I found the following error in config.log, where the output above suggests looking.
/usr/bin/ld:/usr/lib/gcc-lib/i486-linux/3.3.5/../../../libc.so: file format not recognized; treating as linker script
After beating my head on this one for a while, I learned that there is an incompatibility between certain versions of libc and ld. The libc.so file listed contained the following line
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.2 ) )
And, as it turns out, older versions of ld do not understand the AS_NEEDED parameter. So, the fix was to change this line to read as follows:
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )
Problem solved!