gcc-mp-4.8 -march=native fails

Vincent Habchi vince at macports.org
Tue Mar 18 01:43:57 PDT 2014


Le 18 mars 2014 à 07:06, Watson Ladd <watsonbladd at gmail.com> a écrit :

> Dear all,
> When I attempt to compile a C program using -march=native I receive a
> bunch of errors about nonexistent instructions in temporary assembler
> files. This does not happen without that command.
> 
> Does anyone have any bright ideas for how to fix this? Has anyone else
> had this problem and been able to fix it?

You can’t compile with -march=native using gcc. All gcc compilers rely on Apple provided old ‘as’, which is frozen at the last GPL v2 revision (Apple decided to chuck all v3 GPL’d code). This version is so hoary that it does not support neither AVX nor newer extensions.

As a result, if you use -march=native with a reasonably modern hardware, GCC will pass AVX instructions to Apple ‘as’ which rejects them as unknown.

If you want to use the -march=native switch, use Clang instead (LLVM-AS handles new extensions correctly).

Vincent



More information about the macports-users mailing list