gfortran make 函数出错:无效选项 -- I

Error in gfortran make function: invalid option -- I

我有以下简单代码 运行 brew 链接到 gcc 和 openmpi:

 mpif90 test.f90 ./test 

返回以下错误:

 /opt/local/bin/gfortran: invalid option -- I
 Usage: gcov [OPTION]... SOURCE|OBJ...

 Print code coverage information.

   -h, --help                      Print this help, then exit
   -a, --all-blocks                Show information for every basic block
   -b, --branch-probabilities      Include branch probabilities in output
   -c, --branch-counts             Output counts of branches taken
                                rather than percentages
   -d, --display-progress          Display progress information
   -f, --function-summaries        Output summaries for each function
    -i, --intermediate-format       Output .gcov file in intermediate text format
     -l, --long-file-names           Use long output file names for included
                                source files
     -m, --demangled-names           Output demangled function names
     -n, --no-output                 Do not create an output file
     -o, --object-directory DIR|FILE Search for object files in DIR or called FILE
     -p, --preserve-paths            Preserve all pathname components
     -r, --relative-only             Only show data for relative sources
     -s, --source-prefix DIR         Source prefix to elide
     -u, --unconditional-branches    Show unconditional branch counts too
     -v, --version                   Print version number, then exit

   For bug reporting instructions, please see:
   <https://trac.macports.org/newticket>.

我不确定是什么问题。有什么想法吗?谢谢。

问题是其他 /bin/ 目录有旧版本的 gcc 和 openmpi。更新时,需要将 /lib/ 目录中的新文件传输到 /Cellar/ 目录。当第一次卸载所有旧的 macports 和编译器时,问题已解决,文件 and/or 路径不正确,如 sudo port -fp uninstall installedbrew uninstall openmpibrew uninstall gcc。然后重新安装新的自制编译器 brew install gccbrew install openmpi。这在提交 make 文件时给出了配置文件的正确路径。