C compiler to build Sparc/Solaris binaries on Linux

Just that the Subject says.

I am looking for a C compiler for Linux x86 that will allow me to compile a C source code file and the resulting binary will be able to run on a Sparc running Solaris.

Thanks.

This is what's known as cross-compilation, and it's not that simple. gcc can be configured to cross-compile, yes, but that's not usually installed as standard, it's not as easy as "add sparc module", and there's more to it than the compiler. You need the Solaris headers and libraries, too -- after all you're compiling for Sparc/Solaris, not Sparc/GNU. Even if you do get a working sparc compiler on x86, you could be plagued with weird issues. You wouldn't even have a way to test your executables.

My suggestion would be to just get a sparc on ebay.

I would second everything Corona688 has said here, you can pick up an ultra 5 or 10 on Ebay for peanuts these days, and would be a more worthwhile invesment than the time it would take to get the cross compile working.