![使用 gfortran 在 Mac OS 10.13.3 上安装 OpenMPI](https://linux22.com/image/1560659/%E4%BD%BF%E7%94%A8%20gfortran%20%E5%9C%A8%20Mac%20OS%2010.13.3%20%E4%B8%8A%E5%AE%89%E8%A3%85%20OpenMPI.png)
我安装了 gfortran,并且有可用的 dmg 文件这里,下载并解压可用的 tar 文件这里,然后运行./configure --prefix=/usr/local/。
当它尝试检测我的 Fortran 编译器时,我得到了以下输出
*** Fortran compiler checking for gfortran... gfortran checking whether we are using the GNU Fortran compiler... no checking whether gfortran accepts -g... no checking whether ln -s works... yes checking if Fortran compiler works... no
**********************************************************************
* It appears that your Fortran compiler is unable to produce working
* executables. A simple test application failed to properly
* execute. Note that this is likely not a problem with Open MPI,
* but a problem with the local compiler installation. More
* information (including exactly what command was given to the
* compiler and what error resulted when the command was executed) is
* available in the config.log file in the Open MPI build directory.
**********************************************************************
configure: error: Could not run a simple Fortran program. Aborting.
它似乎找到了 gfortran,但随后它说“我们没有使用 GNU Fortran 编译器”,然后编译测试失败。为什么会发生这种情况?
答案1
我第一次使用 Mojave 时就遇到了这个问题(或多或少!)。答案(经过多次尝试)很简单:使用FC=gfortran
而不是 之类的东西F90=gfortran
,例如 希望这能有所帮助。
我的完整配置输入是:
./configure --prefix=/Users/Shared/openmpi311 F77=gfortran FC=gfortran \
CC=clang CXX=c++ --enable-static 2>&1 | tee openmpi-config.out