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:

http://www.commandlinefu.com/commands/view/3126/show-gcc-generated-optimization-commands-when-using-the-marchnative-or-mtunenative-switches-for-compilation.

run it, it outputs (for me)

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

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

yikesers

Leave a Reply

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


two × = 10

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>