On Jan 4, 2013, at 2:55 AM CST, Torbjörn Björkman wrote:
> It seems that a very old bug (svn.open-mpi.org/trac/ompi/ticket/1982) is playing up when linking fortran code with mpicc on Mac OS X 10.6 and the Macports distribution openmpi @1.6.3_0+gcc44. I got it working by reading up on this discussion thread:
> and applying the fix given there, add '-Wl,-commons,use_dylibs', to the c compiler flags solves the problem.
I'm not an Open MPI developer (or user, really), but in MPICH we also had to ensure that we passed both "-Wl,-commons,use_dylibs" *and* "-Wl,-flat_namespace" in the end. For MPI users that do not use Fortran (and therefore don't need common blocks to work correctly between the app and the library), we provide a "--enable-two-level-namespace" configure option to allow users to generate two-level namespace dylibs instead. Some combinations of third-party dylibs will require two-level namespaced MPI dylibs.
I don't know if Open MPI is using "-Wl,-flat_namespace" or not, but this is something else that any investigation should probably check.
For reference on the later MPICH discoveries about dynamically linking common symbols on Darwin: http://trac.mpich.org/projects/mpich/ticket/1590