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

Patrick Aboyoun paboyoun at fhcrc.org
Thu Jan 17 00:03:37 CET 2008


Thanks Bill for the suggestion, but conflicting -arch and -march 
compiler flags don't appear to be the issue. Here are some other 
compilation attempts:


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

Leopard$ g++-4.2 -arch x86_64 -g -O2 -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

Leopard$ g++-4.2 -g -O2 -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

Leopard$ g++-4.2 -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

Leopard$ g++-4.2 hello.cpp
In file included from hello.cpp:2:
hello.hpp: In function 'int atomic_exchange_and_add(int*, int)':
hello.hpp:11: error: asm blocks not enabled, use `-fasm-blocks'
hello.hpp:15: error: expected `)' before ':' token


Cheers,
Patrick




Bill Northcott wrote:
> 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