Search code examples
macosmpigfortranmacos-big-sur

Mpif90 does not compile properly after updating to Mac Big Sur


I recently upgraded to Big Sur and am having trouble running a code on mpi. I am running a test code with the following command:

mpif90 -o test.f90 ./test

I receive the following error:

-bash: mpif90: command not found

I have updated homebrew and macports yet am unable to solve the problem. I suspect it has something to do with an incorrect path name somewhere. Any ideas? Thank you.

@Oo.oO Thank you. When configuring the build of gcc (per the link in your comment) by the command:

 ../configure --prefix=$HOME/opt/usr/local/gcc/gcc-9.2.0 \
 --enable-checking=release \
 --enable-languages=c,c++,fortran \
 --disable-multilib \
 --with-sysroot=$HOME/opt/usr/local/gcc_system_root \
 --program-suffix=-9.2.0

the following error occurs:

 configure: error: in `$HOME/opt/src/gcc/gcc-9.2.0/build':
 configure: error: C compiler cannot create executables

I have updated Xcode (Version 12.3). Any thoughts? Thank you.


Solution

  • The problem was there were other /bin/ directories that had older versions of gcc and openmpi. When updating, the new files from /lib/ directories needed to be trasnfered to the /Cellar/ directories. The problem is fixed when first uninstalling all old macports and compilers with incorrect files and/or paths as sudo port -fp uninstall installed, and brew uninstall openmpi, and brew uninstall gcc. Then reinstall new homebrew compilers brew install gcc, brew install openmpi. This gives the correct paths with configured files when submitting a make file, or in this case, using the mpif90 command.