[petsc-dev] defaulting gnu compilers on Apple

Satish Balay balay at mcs.anl.gov
Thu Oct 31 09:42:11 CDT 2013


>From what I remember - I think Jed mentioned - clang supports most of
the usual gcc options. Perhaps you can try the following to see if
they are identical.

<<< clang option that gcc does not support >>>>
balay at mockingbird /home/balay/junk
$ gcc --analyze sizeof.c
gcc: error: unrecognized command line option ‘--analyze’
balay at mockingbird /home/balay/junk
$ clang --analyze sizeof.c
balay at mockingbird /home/balay/junk

<<<< gcc option that clang does not support >>>>
balay at mockingbird /home/balay/junk
$ clang -fsel-sched-pipelining sizeof.c
clang: warning: argument unused during compilation: '-fsel-sched-pipelining'
balay at mockingbird /home/balay/junk


Satish

On Thu, 31 Oct 2013, Barry Smith wrote:

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