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

Patrick Aboyoun paboyoun at fhcrc.org
Tue Jan 15 19:52:57 CET 2008


I am in the process of reconfiguring the build environment for the 
BioConductor packages on Mac OS X Leopard and am having an issue with 
the compilation of assembly instruction using the GNU gcc/g++ version 
2.4.1 (Apple Inc. build 5531) compiler and can't tell if this is a bug 
in the compiler, problem with the assembly code, or compiler flag 
misspecification. To demonstrate the issue I have taken a standard hello 
world application and injected some assembly instruction into a header 
file. I have two versions of GNU gcc/g++ compilers:

Leopard$ g++-4.2 --version
i686-apple-darwin9-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5531)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Leopard$ g++-4.0 --version
i686-apple-darwin9-g++-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

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...}


The "mutant" hello world application compiles using gcc/g++ 4.2.1 
compilers on SUSE Linux and MinGW for Windows environments so it looks 
like there is something about the Apple port that is causing this issue. 
Does anybody have any insight on this matter? I would rather not 
rollback to the 4.0.1 compilers.


Patrick

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: hello.cpp
Url: https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20080115/a6ce2cd0/attachment.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: hello.hpp
Url: https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20080115/a6ce2cd0/attachment-0001.pl 


More information about the R-SIG-Mac mailing list