1

I am trying to build the Trilinos library on Mac OS X 10.6.8, basically following the instructions on this page and the CMake Quickstart document included with Trilinos.

In order to build it with CMake, the instructions recommend setting up a directory, e.g. /usr/local/trilinos, creating a ./do-configure script in it and running it. My script is:

EXTRA_ARGS=$@

cmake \
    -D CMAKE_BUILD_TYPE:STRING=DEBUG \
    -D Trilinos_ENABLE_TESTS:BOOL=ON \
    $EXTRA_ARGS \
    ${TRILINOS_HOME}

Running this script starts the configuration, until an error appears. The verbose output can be found here: http://pastebin.com/abrEghD7

I think the relevant part of the message is:

-- Verifying Fortran/CXX Compiler Compatibility - Failed
CMake Error at /usr/local/Cellar/cmake/2.8.7/share/cmake/Modules/FortranCInterface.cmake:284 (message):
  The Fortran compiler:

    /usr/local/bin/gfortran

  and the CXX compiler:

    /usr/bin/c++

  failed to compile a simple test project using both languages.  The output
  was:

However, I cannot explain why the script blames the Fortran and C++ compilers. I have tested the Fortran compiler with "Hello World", and used the C++ compiler of OS X for entire projects. As far as I can tell, both compilers work properly.

Can anyone guess what might be wrong?

EDIT: Seems like it is some compatibility issue, not a problem with the indivual compilers.

valiano
  • 16,433
  • 7
  • 64
  • 79
clstaudt
  • 21,436
  • 45
  • 156
  • 239

2 Answers2

1

Where did you get gfortran from? Builds from most sources don't support mac specific extensions like -arch which might make problems trying to combine both of them. Or they might just be different versions (if you're gfortran is much newer than your g++ they might be trying to pull in incompatible runtime versions).

In the numerical python community (which depends a lot on fortran) the recommended source for OS X is the binary from here. This is matched to the XCode gcc version and supports the Mac specific extensions.

robince
  • 10,826
  • 3
  • 35
  • 48
1

When I compile paraview. I set my CXX compiler to g++ and not the standard c++ as cmake does. Because otherwise I see a similar error.

Azrael3000
  • 1,847
  • 12
  • 23
  • I tried `g++` by setting an option in the `do-configure` script. The error remains the same. – clstaudt Mar 29 '12 at 10:11
  • Did you check that it says `and the CXX compiler: /usr/bin/g++`? – Azrael3000 Mar 29 '12 at 11:34
  • Yes. It says: -- Check for working CXX compiler: /usr/bin/g++ -- Check for working CXX compiler: /usr/bin/g++ -- works -- Verifying Fortran/CXX Compiler Compatibility - Failed CMake Error at /usr/local/Cellar/cmake/2.8.7/share/cmake/Modules/FortranCInterface.cmake:284 (message): The Fortran compiler: /usr/local/bin/gfortran and the CXX compiler: /usr/bin/g++ failed to compile a simple test project using both languages. – clstaudt Mar 30 '12 at 14:26