Alot more background is needed here.
What configuration settings did you apply here?
You say 'unless I use gcc', but does that imply that if you use, presumably, Sun's native compiler, or some other vendors compiler you get the error?
The error is 'Illegal Instruction' which is sort of a catastrophic error in a build. I presume that this non-gcc compiler was in use? What are you using for CFLAGS?
Does your compiler have all of its patches up to date? If you haven't checked for patches since installing it, do so NOW, before you try again.
<gripe> Does anyone find that some people when asking for help have the annoying habit of giving the absolute minimum ammount of information that they can get away with?</gripe done=fornow>