[petsc-dev] defaulting gnu compilers on Apple

Barry Smith bsmith at mcs.anl.gov
Thu Oct 31 07:10:17 CDT 2013


   They are not aliases but I cannot determine if there is a difference in functionality

~/Src/petsc  next $ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
~/Src/petsc  next $ clang --version
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
~/Src/petsc  next $ ls -l /usr/bin/gcc
-rwxr-xr-x  1 root  wheel  14224 Oct 22 20:01 /usr/bin/gcc
~/Src/petsc  next $ ls -l /usr/bin/clang
-rwxr-xr-x  1 root  wheel  14224 Oct 22 20:01 /usr/bin/clang
~/Src/petsc  next $ diff /usr/bin/clang /usr/bin/gcc
Binary files /usr/bin/clang and /usr/bin/gcc differ
~/Src/petsc  next $ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
~/Src/petsc  next $ clang++ --version
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
~/Src/petsc  next $ diff /usr/bin/clang++ /usr/bin/g++
Binary files /usr/bin/clang++ and /usr/bin/g++ differ

man gcc returns the manual page for gcc (with its huge number of crazy gnu specific stuff) while man clang gives back a smaller clang/llvm manual page. 

I guess someone needs to bite the bullet and test the gcc options that are not clang options and see if they work with /usr/bin/gcc 

If Xcode’s gcc does not support gcc options then we should not default to using it since that is way confusing!

   Barry



On Oct 31, 2013, at 12:12 AM, Sean Farley <sean.michael.farley at gmail.com> wrote:

> 
> balay at mcs.anl.gov writes:
> 
>> On Thu, 31 Oct 2013, Sean Farley wrote:
>> 
>>> 
>>> balay at mcs.anl.gov writes:
>>> 
>>>> unless everyone is using xcode5 - I think gcc/g++ is a safer default.
>>> 
>>> Apple stopped shipping gcc with Xcode 4.2 [1]. Since that version,
>>> everyone has been using the llvm backend.
>> 
>> The isse is clang frontend with xcode4 is buggy [breaks with petsc build]
>> 
>> http://lists.mcs.anl.gov/pipermail/petsc-dev/2013-October/thread.html
> 
> It would appear so.
> 
>>> Only in version >= 5.0 has
>>> llvm-gcc been dropped. And in Mavericks only libc++ (and not libstdc++)
>>> is shipped.
>>> 
>>> [1] http://en.wikipedia.org/wiki/Xcode#Toolchain_Versions
>> 
>> Since /usr/bin/gcc is an alias to clang in Xcode5 - there is no need
>> to change defaults on OSX as Barry is suggesting?
> 
> Probably, but I haven't tested.




More information about the petsc-dev mailing list