[R-SIG-Mac] Compiling assembly instruction on GNU gcc/g++ 4.2.1 (Apple Inc. build 5531)

Bill Northcott w.northcott at unsw.edu.au
Wed Jan 16 23:45:23 CET 2008


On 16/01/2008, at 8:49 PM, Patrick Aboyoun wrote:

> When I try to compile the "mutant" hello world application on the  
> 4.2.1
> version I get the following error message:
>
> Leopard$ g++-4.2 -arch x86_64 -g -O2 -march=nocona -fasm-blocks  
> hello.cpp
> In file included from hello.cpp:2:
> hello.hpp: In function ?int atomic_exchange_and_add(int*, int)?:
> hello.hpp:15: error: expected `)' before ?:? token
>
> and I have no issue when I compile on the 4.0.1 version
>
> Leopard$ g++-4.0 -arch x86_64 -g -O2 -march=nocona -fasm-blocks  
> hello.cpp
> {...object file created without issue...}

I don't know, but I would suspect that your problem is in using '-arch  
x86_64' and '-march=nocona'.

As I understand the first means "build this for the full range of  
present and future Apple 64 bit Intel hardware and, if specified, lipo  
it up into a fat binary'  While the second means 'optimise this for  
nocona architecture.'

I would have thought you could combine -march nocona with -m64, but  
combining it with -arch x86_64 might just confuse the compiler.

Bill



More information about the R-SIG-Mac mailing list