[Trilinos-Users] Building under OS X Lion

Heroux, Michael A maherou at sandia.gov
Thu Feb 9 10:25:16 MST 2012

I am forwarding this to the Trilinos Users list.  It was sent by a user to the Framework list, but I ran into the issue myself last night, and thought there might be others out there who would be interested.

The basic problem is that the default Xcode compilers for 4.2 do not work with one of the Teuchos test programs:


I used the Cmake arguments to get the right compilers (see below).

Also,  for those who want a compatible Fortran compiler, (remember that mixing one version of g++/gcc  with a different version of gfortran leads to strange link-time errors), it appears that the installation file from:

http://r.research.att.com/tools, specifically:


 works for building Trilinos with Fortran enabled and with the native Apple-provided gcc and g++ compilers, at least all of my tests have passed.

Just add

-D CMAKE_C_COMPILER:FILEPATH=/usr/bin/gfortran-4.2 \

To your Cmake command.


Hi Brent,

Thanks for your reply.  Since I sent the message last night, I've done some more investigating and experimenting.  I believe the situation is this: without being aware of it, I've been using some sort of Apple-provided g++ 4.2 *interface* to llvm.  In 10.7, or perhaps XCode 4.2, Apple made this the thing that /usr/bin/g++ points to.  There is, I presume, a bug in the llvm compiler, which this particular Teuchos test exposes.  Fortunately, Apple does also include the bona fide g++ 4.2.

So, to override the llvm default, I simply did:

export CC=/usr/bin/gcc-4.2
export CXX=/usr/bin/g++-4.2
export CPP=/usr/bin/cpp-4.2
export LD=/usr/bin/ld

and then rebuilt everything (including open-mpi).  This worked.  Alternately, of course, I could have added:

-D CMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc-4.2 \

to my cmake script.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20120209/b6fdcb05/attachment.html 

More information about the Trilinos-Users mailing list