Bad Compiler Options WARNING (was Re: Seg faults while compiling qt/kde)

Auke Kok sofar at lunar-linux.org
Fri Sep 17 08:33:56 UTC 2004



Hi everyone,

a little reminder to prevent this sort of thing in the future, please 
write this down in 7200 points font on a A0 piece of paper and hang 
above your screen:


1) SAFE optimizations are "-march=[proper-cpu-type] 
-mcpu=[proper-cpu-type] -O3"

2) if you have problems with programs segfaulting and you suspect that 
optimizations are the problem drop down to above optimization levels, 
and recompile gcc+glibc+coreutils (plus all applications and libraries 
that are used in the process/compile croaking) subsequently, then 
attempt again.

(2b) most commonly overoptimzation errors are "Illegal Instruction" and 
not "segmentation faults". Segfaults can be anything.)

3) if that doesn't work drop down to "-march=i686 -mcpu=i686 -O2" and repeat

4) if that doesn't work obviously something else is wrong and yer 
screwed. (call us again).


although -fomit-frame-pointer and -funroll-loops are not necessarily 
"bad", they do not inherently improve performance (especially with 
cpuintensive tasks that already are compiled with -O3 and proper cputype 
(gcc already does adequate unrolling), as proven in one of the 
benchmarks tests I performed). Moreover, they might just set off some 
unwanted balance in your disadvantage... so if you are not sure what to 
do DONT USE IT.

(Don't get me wrong here ... I just want to make sure everyone 
understands that using extended optimization flags should not be used 
for all applications at all, if you really need to tweak performance of 
specific programs you are just way better off doing it per-application 
and testing it properly. Arguably it can be shown that you are better 
off (even in speed) by being a bit conservative... it's just nice to 
select p4 optimizations instead of the usual 4/5/686 default that binary 
distros use and that DOES pay off.)

good luck and happy compiling!


sofar



Florin Braescu wrote:

>Pe data de Joi 16 Sep 2004 12:09, Bernd Kosmahl a scris:
>  
>
>>Am Dienstag, 14. September 2004 17:06 tippselte Florin Braescu:
>>    
>>
>>> You have a borkeg gcc. Too many optimizations params i guess. Use o
>>>only -funroll-loop and -fomit-frame-pointer. Relin gcc, coreutils and
>>>the rest after that. You may need to use a rescue cd with a clean gcc
>>>for that.
>>>



More information about the Lunar mailing list