我正在尝试编译 RegCM4.5 我的配置看起来没有错误但是在编译时(通过 make
命令)我得到了这个错误
File ‘mpi.mod’ opened at (1) is not a GNU Fortran module file
我已经通过dnf install
包管理器安装了mpich
。我该如何解决这个问题?
最佳答案
我最近遇到了这个问题。问题是我有不同版本的 gfortran 编译器,而 openmpi 没有指向正确的版本。用于编译我的程序的那个。所以使用 use mpi
语句会导致该错误。输入以下命令将指示当前安装了哪些 Fortran 编译器:
dpkg -l | grep Fortran
我的输出是
ii gfortran 4:5.3.1-1ubuntu1 amd64 GNU Fortran 95 compiler
ii gfortran-4.8 4.8.5-4ubuntu2 amd64 GNU Fortran compiler
ii gfortran-5 5.4.1-2ubuntu1~16.04 amd64 GNU Fortran compiler
ii libgfortran-4.8-dev:amd64 4.8.5-4ubuntu2 amd64 Runtime library for GNU Fortran applications (development files)
ii libgfortran-5-dev:amd64 5.4.1-2ubuntu1~16.04 amd64 Runtime library for GNU Fortran applications (development files)
ii libgfortran3:amd64 6.2.0-3ubuntu11~16.04 amd64 Runtime library for GNU Fortran applications
您可以通过导出您实际使用的 Fortran 编译器来解决这个问题。在我的例子中是 gfortran-4.8,所以我只需要输入
export FC=gfortran-4.8
关于fortran - 在 (1) 打开的文件 ‘mpi.mod’ 不是 GNU Fortran 模块文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38685774/