gcc 4.2.1 woe os x -march=native woe

with os x 10.6’s built-in gcc (4.2.1) it appears you cannot pass “-march=native” to your compiler. It throws up, presumably because it matches the cpu wrong for whatever reason (old version of gcc I think).

array.c:1: error: bad value (native) for -march= switch
array.c:1: error: bad value (nnative) for -mtune= switch

gcc version: 4.2.1 (Apple Inc. build 5666) (dot 3)

Fix for me:

download “gcccpuopt” script from here:


run it, it outputs (for me)

“-m32 -march=core2 -mfpmath=sse”

so use those *instead* of “-march=native”


Leave a Reply

Your email address will not be published. Required fields are marked *