If you've installed the sunfreeware version of gcc, you have to go to
usr/local/lib/gcc-lib/sparc-sun-solaris2.10/3.3.2/install-tools
and run mkheaders. This will fix the problems with the sun headers that are installed.When compiling Python 2.4.2 from source, there was an error:
Objects/complexobject.c: In function `complex_pow':
...
You can find the fix here.