Hi. I'm working on a code that uses OpenMPI, C++, and Fortran. I'm also using cmake to create the make files. If I set the linker to mpicc, it can't find some fortran stuff but knows where the MPI stuff is. If I set the linker to ifort, it finds the fortran stuff but can't find the MPI stuff. So my current solution is to keep the linker as mpicc and reveal to the compiler where the ifort libraries are. Unfortunately, I don't know where they are either. Looking for a way to give the ifort libraries to mpicc or an alternative (entirely different) solution.
For several years, the OpenMPI Fortran wrapper has been named mpifort (just 1 letter different from the Intel MPI one). If your MPI is built with ifort, this will find the Fortran libraries, and -lstdc++ will find the C++ STL.
If you use the MPI C++ wrapper, and have no MPI calls in your Fortran, you would set the ifort environment (as you probably did already) and append the -l specifications for the required libraries in the ifort installation. Normally, 'which ifort' would give you a clue where to look for the libraries associated with your ifort. The C wrapper which you appear to prefer will require -lstdc++ as well as Fortran library specifications.